Skip to content

Commit

Permalink
Fix org.opensearch.index.reindex.ReindexRestClientSslTests#testClient…
Browse files Browse the repository at this point in the history
…SucceedsWithCertificateAuthorities - javax.net.ssl.SSLPeerUnverifiedException (#1212)

Signed-off-by: Andriy Redko <[email protected]>
  • Loading branch information
reta authored Sep 8, 2021
1 parent ddb37de commit 0b773c2
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
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;
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -213,7 +212,7 @@ public void testClientPassesClientCertificate() throws IOException {
}

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);
}
Expand Down

0 comments on commit 0b773c2

Please sign in to comment.