What problem are you trying to solve?
In httpclient 5, setSSLSocketFactory is not available on the HttpClientBuilder anymore (also see this SO question with 35k views as of writing).
Instead the method is available on the HttpClientConnectionManager which can then be set on the builder HttpClientBuilder.setConnectionManager.
What precondition(s) should be checked before applying this recipe?
PoolingHttpClientConnectionManagerBuilder.setSSLSocketFactory is deprecated in httpclient5, so a version check may be needed in the future
Describe the situation before applying the recipe
class A {
void foo(String bar) {
SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(null);
CloseableHttpClient httpClient = HttpClientBuilder
.create()
.setSSLSocketFactory(sslSocketFactory)
.build();
}
}
Describe the situation after applying the recipe
class A {
void foo(String bar) {
SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(null);
HttpClientConnectionManager connectionManager = PoolingHttpClientConnectionManagerBuilder
.create()
.setSSLSocketFactory(sslSocketFactory)
.build();
CloseableHttpClient httpClient = HttpClientBuilder
.create()
.setConnectionManager(connectionManager)
.build();
}
}
no
What problem are you trying to solve?
In httpclient 5,
setSSLSocketFactoryis not available on theHttpClientBuilderanymore (also see this SO question with 35k views as of writing).Instead the method is available on the
HttpClientConnectionManagerwhich can then be set on the builderHttpClientBuilder.setConnectionManager.What precondition(s) should be checked before applying this recipe?
PoolingHttpClientConnectionManagerBuilder.setSSLSocketFactoryis deprecated in httpclient5, so a version check may be needed in the futureDescribe the situation before applying the recipe
Describe the situation after applying the recipe
Are you interested in contributing this recipe to OpenRewrite?
no