File tree Expand file tree Collapse file tree 3 files changed +51
-3
lines changed
modules/jooby-netty/src/main/java/io/jooby/internal/netty
tests/src/test/java/io/jooby Expand file tree Collapse file tree 3 files changed +51
-3
lines changed Original file line number Diff line number Diff line change 7373import io .netty .buffer .Unpooled ;
7474import io .netty .channel .ChannelFuture ;
7575import io .netty .channel .ChannelFutureListener ;
76+ import io .netty .channel .ChannelHandler ;
7677import io .netty .channel .ChannelHandlerContext ;
7778import io .netty .channel .ChannelPipeline ;
7879import io .netty .channel .ChannelPromise ;
@@ -801,7 +802,7 @@ private void prepareChunked() {
801802 // remove flusher, doesn't play well with streaming/chunked responses
802803 ChannelPipeline pipeline = ctx .pipeline ();
803804 if (pipeline .get ("chunker" ) == null ) {
804- String base = Stream .of ("compressor" , "codec" )
805+ String base = Stream .of ("compressor" , "codec" , "http2" )
805806 .filter (name -> pipeline .get (name ) != null )
806807 .findFirst ()
807808 .orElseThrow (() -> new IllegalStateException ("No available handler for chunk writer" ));
Original file line number Diff line number Diff line change 1212import static org .junit .jupiter .api .Assertions .assertNull ;
1313import static org .junit .jupiter .api .Assertions .assertTrue ;
1414import static reactor .core .scheduler .Schedulers .elastic ;
15+ import static reactor .core .scheduler .Schedulers .parallel ;
1516
1617import java .io .ByteArrayInputStream ;
1718import java .io .IOException ;
@@ -1060,12 +1061,12 @@ public void reactor(ServerTestRunner runner) {
10601061 app .get ("/reactor/mono" , ctx ->
10611062 Mono .fromCallable (() -> "Mono" )
10621063 .map (s -> "Hello " + s )
1063- .subscribeOn (elastic ())
1064+ .subscribeOn (parallel ())
10641065 );
10651066 app .get ("/reactor/flux" , ctx ->
10661067 Flux .range (1 , 10 )
10671068 .map (i -> i + "," )
1068- .subscribeOn (elastic ())
1069+ .subscribeOn (parallel ())
10691070 );
10701071 }).ready (client -> {
10711072 client .get ("/reactor/mono" , rsp -> {
Original file line number Diff line number Diff line change 1+ package io .jooby ;
2+
3+ import static org .junit .jupiter .api .Assertions .assertEquals ;
4+
5+ import java .util .Arrays ;
6+
7+ import io .jooby .junit .ServerTest ;
8+ import io .jooby .junit .ServerTestRunner ;
9+ import reactor .core .publisher .Flux ;
10+ import reactor .core .publisher .Mono ;
11+
12+ public class Issue2372 {
13+
14+ @ ServerTest
15+ public void http2 (ServerTestRunner runner ) {
16+ runner .define (app -> {
17+
18+ app .setServerOptions (
19+ new ServerOptions ()
20+ .setHttp2 (true )
21+ .setSecurePort (8443 )
22+ );
23+
24+ app .before (new SSLHandler ());
25+
26+ app .get ("/2372/mono" , ctx -> {
27+ return Mono .fromCallable (() -> "Welcome to Jooby!" );
28+ });
29+
30+ app .get ("/2372/flux" , ctx -> {
31+ return Flux .fromIterable (Arrays .asList ("Welcome" , "to" , "Jooby!" ))
32+ .map (it -> it + " " );
33+ });
34+ }).ready ((http , https ) -> {
35+ https .get ("/2372/flux" , rsp -> {
36+ assertEquals ("Welcome to Jooby!" ,
37+ rsp .body ().string ().trim ());
38+ });
39+ https .get ("/2372/mono" , rsp -> {
40+ assertEquals ("Welcome to Jooby!" ,
41+ rsp .body ().string ());
42+ });
43+ });
44+ }
45+
46+ }
You can’t perform that action at this time.
0 commit comments