import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
-import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
-import org.apache.http.conn.ssl.TrustStrategy;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
+
+import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
+import org.apache.hc.client5.http.impl.classic.HttpClients;
+import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
+import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;
+import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
+import org.apache.hc.core5.ssl.TrustStrategy;
import org.onap.ccsdk.apps.ms.neng.core.exceptions.NengException;
import org.onap.ccsdk.apps.ms.neng.core.policy.PolicyFinder;
import org.onap.ccsdk.apps.ms.neng.core.resource.model.GetConfigRequest;
if (restTemplate != null) {
return restTemplate;
}
+
TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true;
- SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom()
+ SSLContext sslContext = org.apache.hc.core5.ssl.SSLContexts.custom()
.loadTrustMaterial(null, acceptingTrustStrategy).build();
HostnameVerifier verifier = new AcceptIpAddressHostNameVerifier(disableHostVerification);
SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext, verifier);
- CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(csf).build();
+
+ PoolingHttpClientConnectionManager connectionManager = PoolingHttpClientConnectionManagerBuilder.create().setSSLSocketFactory(csf).build();
+ CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(connectionManager).build();
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
+
requestFactory.setHttpClient(httpClient);
restTemplate = new RestTemplate(requestFactory);
restTemplate.getInterceptors().add(getAuthInt());