Fix org.opensearch.index.reindex.ReindexRestClientSslTests#testClientSucceedsWithCertificateAuthorities - javax.net.ssl.SSLPeerUnverifiedException (#1212)

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
This commit is contained in:
Andriy Redko 2021-09-08 09:08:05 -04:00 committed by GitHub
parent ddb37dea32
commit 0b773c2cec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -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);
}