diff options
-rw-r--r-- | models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java | 15 | ||||
-rw-r--r-- | models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java | 2 |
2 files changed, 6 insertions, 11 deletions
diff --git a/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java b/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java index 48a02f07a..f585059a7 100644 --- a/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java +++ b/models-interactions/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java @@ -27,7 +27,6 @@ import jakarta.xml.bind.DatatypeConverter; import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.Map.Entry; -import javax.net.ssl.SSLContext; import org.apache.commons.lang3.tuple.Pair; import org.apache.hc.client5.http.classic.methods.HttpDelete; import org.apache.hc.client5.http.classic.methods.HttpGet; @@ -39,8 +38,8 @@ import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; 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.DefaultClientTlsStrategy; import org.apache.hc.client5.http.ssl.NoopHostnameVerifier; -import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder; import org.apache.hc.core5.http.ClassicHttpResponse; import org.apache.hc.core5.http.ContentType; import org.apache.hc.core5.http.HttpHeaders; @@ -212,14 +211,10 @@ public class RestManager { var sslContext = SSLContexts.createDefault(); PoolingHttpClientConnectionManager connectionManager = - PoolingHttpClientConnectionManagerBuilder.create() - .setSSLSocketFactory( - SSLConnectionSocketFactoryBuilder.create() - .setHostnameVerifier(NoopHostnameVerifier.INSTANCE) - .setSslContext(sslContext) - .build() - ) - .build(); + PoolingHttpClientConnectionManagerBuilder.create() + .setTlsSocketStrategy(new DefaultClientTlsStrategy( + sslContext, NoopHostnameVerifier.INSTANCE)) + .build(); try (CloseableHttpClient client = HttpClientBuilder.create().setConnectionManager(connectionManager).build()) { HttpResponse response = client.execute(request); diff --git a/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java b/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java index 02ae7ece3..1bc3d6e34 100644 --- a/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java +++ b/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java @@ -120,7 +120,7 @@ public class RestTest { assertThrows(NullPointerException.class, () -> { mgr.get(null, "user", null, null); }); - } + } @Test void testPutUrlNull() { |