diff --git a/elasticsearch/build.gradle b/elasticsearch/build.gradle index e5ec5f661bd..1565469d379 100644 --- a/elasticsearch/build.gradle +++ b/elasticsearch/build.gradle @@ -52,6 +52,7 @@ dependencies { // common test deps testCompile 'org.elasticsearch:securemock:1.2' + testCompile "org.elasticsearch:mocksocket:${versions.mocksocket}" testCompile 'org.slf4j:slf4j-log4j12:1.6.2' testCompile 'org.slf4j:slf4j-api:1.6.2' } diff --git a/elasticsearch/src/test/java/org/elasticsearch/test/http/MockWebServer.java b/elasticsearch/src/test/java/org/elasticsearch/test/http/MockWebServer.java index 0246499925f..f6d0b244144 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/test/http/MockWebServer.java +++ b/elasticsearch/src/test/java/org/elasticsearch/test/http/MockWebServer.java @@ -19,6 +19,7 @@ import org.elasticsearch.common.io.Streams; import org.elasticsearch.common.logging.ESLoggerFactory; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.ConcurrentCollections; +import org.elasticsearch.mocksocket.MockHttpServer; import javax.net.ssl.SSLContext; import java.io.Closeable; @@ -83,11 +84,11 @@ public class MockWebServer implements Closeable { public void start() throws IOException { InetSocketAddress address = new InetSocketAddress(InetAddress.getLoopbackAddress().getHostAddress(), 0); if (sslContext != null) { - HttpsServer httpsServer = HttpsServer.create(address, 0); + HttpsServer httpsServer = MockHttpServer.createHttps(address, 0); httpsServer.setHttpsConfigurator(new CustomHttpsConfigurator(sslContext, needClientAuth)); server = httpsServer; } else { - server = HttpServer.create(address, 0); + server = MockHttpServer.createHttp(address, 0); } server.start();