diff --git a/commercetools/commercetools-apachehttp-client/build.gradle b/commercetools/commercetools-apachehttp-client/build.gradle index 52af4078c29..91b932ac590 100644 --- a/commercetools/commercetools-apachehttp-client/build.gradle +++ b/commercetools/commercetools-apachehttp-client/build.gradle @@ -1,9 +1,9 @@ dependencies { api project(":rmf:rmf-java-base") - api "org.apache.httpcomponents.client5:httpclient5:5.3.1" version { + api "org.apache.httpcomponents.client5:httpclient5:5.4.1" version { strictly "[5.0,6.0[" - prefer "5.1.3" + prefer "5.4.1" } api commons.io version commons.io_version diff --git a/commercetools/commercetools-apachehttp-client/src/main/java/com/commercetools/http/apachehttp/CtApacheHttpClient.java b/commercetools/commercetools-apachehttp-client/src/main/java/com/commercetools/http/apachehttp/CtApacheHttpClient.java index d0599578dc8..6401f0a9775 100644 --- a/commercetools/commercetools-apachehttp-client/src/main/java/com/commercetools/http/apachehttp/CtApacheHttpClient.java +++ b/commercetools/commercetools-apachehttp-client/src/main/java/com/commercetools/http/apachehttp/CtApacheHttpClient.java @@ -19,6 +19,7 @@ import org.apache.hc.client5.http.async.methods.SimpleBody; import org.apache.hc.client5.http.async.methods.SimpleHttpResponse; import org.apache.hc.client5.http.async.methods.SimpleResponseConsumer; +import org.apache.hc.client5.http.config.TlsConfig; import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; import org.apache.hc.client5.http.impl.async.HttpAsyncClientBuilder; import org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManagerBuilder; @@ -32,7 +33,6 @@ import org.apache.hc.core5.http.nio.support.AsyncRequestBuilder; import org.apache.hc.core5.http2.HttpVersionPolicy; import org.apache.hc.core5.reactor.IOReactorStatus; -import org.apache.hc.core5.reactor.ssl.TlsDetails; public class CtApacheHttpClient extends HttpClientBase { public static final int MAX_REQUESTS = 64; @@ -46,19 +46,19 @@ public static HttpAsyncClientBuilder createClientBuilder() { } public static HttpAsyncClientBuilder createClientBuilder(AsyncClientConnectionManager cm) { - return HttpAsyncClientBuilder.create().setVersionPolicy(HttpVersionPolicy.NEGOTIATE).setConnectionManager(cm); + return HttpAsyncClientBuilder.create().setConnectionManager(cm); } public static PoolingAsyncClientConnectionManagerBuilder createConnectionManager(final int maxConnTotal, final int maxConnPerRoute) { - final TlsStrategy tlsStrategy = ClientTlsStrategyBuilder.create() - .useSystemProperties() - .setTlsDetailsFactory( - sslEngine -> new TlsDetails(sslEngine.getSession(), sslEngine.getApplicationProtocol())) + final TlsStrategy tlsStrategy = ClientTlsStrategyBuilder.create().useSystemProperties().build(); + final TlsConfig tlsConfig = TlsConfig.copy(TlsConfig.DEFAULT) + .setVersionPolicy(HttpVersionPolicy.NEGOTIATE) .build(); return PoolingAsyncClientConnectionManagerBuilder.create() .setMaxConnPerRoute(maxConnPerRoute) .setMaxConnTotal(maxConnTotal) + .setDefaultTlsConfig(tlsConfig) .setTlsStrategy(tlsStrategy); }