99
1010import javax .net .ssl .SSLContext ;
1111
12- import org .apache .hc .client5 .http .impl .routing .DefaultProxyRoutePlanner ;
13- import org .junit .jupiter .api .Test ;
14-
1512import org .apache .hc .client5 .http .async .methods .SimpleHttpRequest ;
1613import org .apache .hc .client5 .http .async .methods .SimpleHttpResponse ;
1714import org .apache .hc .client5 .http .async .methods .SimpleRequestBuilder ;
1815import org .apache .hc .client5 .http .auth .AuthScope ;
1916import org .apache .hc .client5 .http .auth .UsernamePasswordCredentials ;
2017import org .apache .hc .client5 .http .classic .methods .HttpGet ;
21- import org .apache .hc .client5 .http .config .RequestConfig ;
2218import org .apache .hc .client5 .http .cookie .BasicCookieStore ;
2319import org .apache .hc .client5 .http .impl .async .CloseableHttpAsyncClient ;
2420import org .apache .hc .client5 .http .impl .async .HttpAsyncClients ;
2521import org .apache .hc .client5 .http .impl .auth .BasicCredentialsProvider ;
2622import org .apache .hc .client5 .http .impl .cookie .BasicClientCookie ;
2723import org .apache .hc .client5 .http .impl .nio .PoolingAsyncClientConnectionManager ;
2824import org .apache .hc .client5 .http .impl .nio .PoolingAsyncClientConnectionManagerBuilder ;
25+ import org .apache .hc .client5 .http .impl .routing .DefaultProxyRoutePlanner ;
2926import org .apache .hc .client5 .http .protocol .HttpClientContext ;
3027import org .apache .hc .client5 .http .ssl .ClientTlsStrategyBuilder ;
31- import org .apache .hc .core5 .concurrent .FutureCallback ;
3228import org .apache .hc .core5 .http .HttpHost ;
3329import org .apache .hc .core5 .http .HttpResponse ;
3430import org .apache .hc .core5 .http .nio .ssl .TlsStrategy ;
3733import org .apache .hc .core5 .reactor .IOReactorConfig ;
3834import org .apache .hc .core5 .ssl .SSLContexts ;
3935import org .apache .hc .core5 .ssl .TrustStrategy ;
36+ import org .apache .http .conn .ssl .SSLConnectionSocketFactory ;
37+ import org .junit .jupiter .api .Test ;
4038
4139
4240class HttpAsyncClientLiveTest extends GetRequestMockServer {
@@ -56,12 +54,10 @@ class HttpAsyncClientLiveTest extends GetRequestMockServer {
5654
5755 @ Test
5856 void whenUseHttpAsyncClient_thenCorrect () throws InterruptedException , ExecutionException , IOException {
59- final HttpHost target = new HttpHost (HOST_WITH_COOKIE );
60- final SimpleHttpRequest request = SimpleRequestBuilder . get ()
61- . setHttpHost ( target )
57+ final SimpleHttpRequest request = SimpleRequestBuilder . get (HOST_WITH_COOKIE )
58+ . build ();
59+ final CloseableHttpAsyncClient client = HttpAsyncClients . custom ( )
6260 .build ();
63-
64- final CloseableHttpAsyncClient client = HttpAsyncClients .custom ().build ();
6561 client .start ();
6662
6763
@@ -126,6 +122,7 @@ void whenUseSSLWithHttpAsyncClient_thenCorrect() throws Exception {
126122 .build ();
127123
128124 final TlsStrategy tlsStrategy = ClientTlsStrategyBuilder .create ()
125+ .setHostnameVerifier (SSLConnectionSocketFactory .ALLOW_ALL_HOSTNAME_VERIFIER )
129126 .setSslContext (sslContext )
130127 .build ();
131128
0 commit comments