@@ -66,39 +66,39 @@ public void connectionClosed(SessionProtocol protocol, InetSocketAddress remoteA
6666 }
6767 };
6868
69- final ClientFactory factory = ClientFactory .builder ()
69+ try ( ClientFactory factory = ClientFactory .builder ()
7070 .connectionPoolListener (poolListener )
71- .build ();
72- final WebClient client = WebClient .builder (server .uri (SessionProtocol .H1C ))
73- .factory (factory )
74- .build ();
71+ .build ()) {
72+ final WebClient client = WebClient .builder (server .uri (SessionProtocol .H1C ))
73+ .factory (factory )
74+ .build ();
7575
76- final AggregatedHttpResponse res1 = client
77- .execute (HttpRequest .of (HttpMethod .CONNECT , "/" ))
78- .aggregate ()
79- .join ();
80- assertThat (res1 .status ()).isSameAs (HttpStatus .METHOD_NOT_ALLOWED );
81- await ().untilAsserted (() -> {
82- assertThat (openedCount ).hasValue (1 );
83- assertThat (closedCount ).hasValue (1 );
84- });
76+ final AggregatedHttpResponse res1 = client
77+ .execute (HttpRequest .of (HttpMethod .CONNECT , "/" ))
78+ .aggregate ()
79+ .join ();
80+ assertThat (res1 .status ()).isSameAs (HttpStatus .METHOD_NOT_ALLOWED );
81+ await ().untilAsserted (() -> {
82+ assertThat (openedCount ).hasValue (1 );
83+ assertThat (closedCount ).hasValue (1 );
84+ });
8585
86- final AggregatedHttpResponse res2 = client
87- .prepare ()
88- .method (HttpMethod .CONNECT )
89- .path ("/" )
90- .header (HttpHeaderNames .PROTOCOL , "websocket" )
91- .execute ()
92- .aggregate ()
93- .join ();
86+ final AggregatedHttpResponse res2 = client
87+ .prepare ()
88+ .method (HttpMethod .CONNECT )
89+ .path ("/" )
90+ .header (HttpHeaderNames .PROTOCOL , "websocket" )
91+ .execute ()
92+ .aggregate ()
93+ .join ();
9494
95- // HTTP/1 decoder will reject a header starts with `:` anyway.
96- assertThat (res2 .status ()).isSameAs (HttpStatus .BAD_REQUEST );
97- await ().untilAsserted (() -> {
98- assertThat (openedCount ).hasValue (2 );
99- assertThat (closedCount ).hasValue (2 );
100- });
101- factory . closeAsync ();
95+ // HTTP/1 decoder will reject a header starts with `:` anyway.
96+ assertThat (res2 .status ()).isSameAs (HttpStatus .BAD_REQUEST );
97+ await ().untilAsserted (() -> {
98+ assertThat (openedCount ).hasValue (2 );
99+ assertThat (closedCount ).hasValue (2 );
100+ });
101+ }
102102 }
103103
104104 @ Test
0 commit comments