19
19
import org .apache .hc .client5 .http .async .methods .SimpleBody ;
20
20
import org .apache .hc .client5 .http .async .methods .SimpleHttpResponse ;
21
21
import org .apache .hc .client5 .http .async .methods .SimpleResponseConsumer ;
22
+ import org .apache .hc .client5 .http .config .TlsConfig ;
22
23
import org .apache .hc .client5 .http .impl .async .CloseableHttpAsyncClient ;
23
24
import org .apache .hc .client5 .http .impl .async .HttpAsyncClientBuilder ;
24
25
import org .apache .hc .client5 .http .impl .nio .PoolingAsyncClientConnectionManagerBuilder ;
32
33
import org .apache .hc .core5 .http .nio .support .AsyncRequestBuilder ;
33
34
import org .apache .hc .core5 .http2 .HttpVersionPolicy ;
34
35
import org .apache .hc .core5 .reactor .IOReactorStatus ;
35
- import org .apache .hc .core5 .reactor .ssl .TlsDetails ;
36
36
37
37
public class CtApacheHttpClient extends HttpClientBase {
38
38
public static final int MAX_REQUESTS = 64 ;
@@ -46,19 +46,19 @@ public static HttpAsyncClientBuilder createClientBuilder() {
46
46
}
47
47
48
48
public static HttpAsyncClientBuilder createClientBuilder (AsyncClientConnectionManager cm ) {
49
- return HttpAsyncClientBuilder .create ().setVersionPolicy ( HttpVersionPolicy . NEGOTIATE ). setConnectionManager (cm );
49
+ return HttpAsyncClientBuilder .create ().setConnectionManager (cm );
50
50
}
51
51
52
52
public static PoolingAsyncClientConnectionManagerBuilder createConnectionManager (final int maxConnTotal ,
53
53
final int maxConnPerRoute ) {
54
- final TlsStrategy tlsStrategy = ClientTlsStrategyBuilder .create ()
55
- .useSystemProperties ()
56
- .setTlsDetailsFactory (
57
- sslEngine -> new TlsDetails (sslEngine .getSession (), sslEngine .getApplicationProtocol ()))
54
+ final TlsStrategy tlsStrategy = ClientTlsStrategyBuilder .create ().useSystemProperties ().build ();
55
+ final TlsConfig tlsConfig = TlsConfig .copy (TlsConfig .DEFAULT )
56
+ .setVersionPolicy (HttpVersionPolicy .NEGOTIATE )
58
57
.build ();
59
58
return PoolingAsyncClientConnectionManagerBuilder .create ()
60
59
.setMaxConnPerRoute (maxConnPerRoute )
61
60
.setMaxConnTotal (maxConnTotal )
61
+ .setDefaultTlsConfig (tlsConfig )
62
62
.setTlsStrategy (tlsStrategy );
63
63
}
64
64
0 commit comments