From 0b773c2ceccbb54d5f7bdfa8e3dc0d84659626bf Mon Sep 17 00:00:00 2001 From: Andriy Redko Date: Wed, 8 Sep 2021 09:08:05 -0400 Subject: [PATCH] Fix org.opensearch.index.reindex.ReindexRestClientSslTests#testClientSucceedsWithCertificateAuthorities - javax.net.ssl.SSLPeerUnverifiedException (#1212) Signed-off-by: Andriy Redko --- .../opensearch/index/reindex/ReindexRestClientSslTests.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/reindex/src/test/java/org/opensearch/index/reindex/ReindexRestClientSslTests.java b/modules/reindex/src/test/java/org/opensearch/index/reindex/ReindexRestClientSslTests.java index 645517d8ad2..0e944907b4f 100644 --- a/modules/reindex/src/test/java/org/opensearch/index/reindex/ReindexRestClientSslTests.java +++ b/modules/reindex/src/test/java/org/opensearch/index/reindex/ReindexRestClientSslTests.java @@ -62,7 +62,6 @@ import javax.net.ssl.TrustManager; import javax.net.ssl.X509ExtendedKeyManager; import javax.net.ssl.X509ExtendedTrustManager; import java.io.IOException; -import java.net.InetAddress; import java.net.InetSocketAddress; import java.nio.file.Path; import java.security.cert.Certificate; @@ -90,7 +89,7 @@ public class ReindexRestClientSslTests extends OpenSearchTestCase { @BeforeClass public static void setupHttpServer() throws Exception { - InetSocketAddress address = new InetSocketAddress(InetAddress.getLoopbackAddress().getHostAddress(), 0); + InetSocketAddress address = new InetSocketAddress("localhost", 0); SSLContext sslContext = buildServerSslContext(); server = MockHttpServer.createHttps(address, 0); server.setHttpsConfigurator(new ClientAuthHttpsConfigurator(sslContext)); @@ -213,7 +212,7 @@ public class ReindexRestClientSslTests extends OpenSearchTestCase { } private RemoteInfo getRemoteInfo() { - return new RemoteInfo("https", server.getAddress().getHostName(), server.getAddress().getPort(), "/", + return new RemoteInfo("https", "localhost", server.getAddress().getPort(), "/", new BytesArray("{\"match_all\":{}}"), "user", "password", Collections.emptyMap(), RemoteInfo.DEFAULT_SOCKET_TIMEOUT, RemoteInfo.DEFAULT_CONNECT_TIMEOUT); }