Skip to content
Permalink
Browse files
fix failed testSSLConnectionFailsIfOnlyHttpConfigured
  • Loading branch information
korlov42 authored and gaul committed Feb 12, 2021
1 parent d74dcca commit d7897b3d25816d2ca2b35e4af7bb573ef2eb3d14
Showing 1 changed file with 11 additions and 1 deletion.
@@ -24,6 +24,7 @@
import static org.testng.Assert.assertNotNull;

import java.io.Closeable;
import java.io.IOException;
import java.util.List;
import java.util.Properties;

@@ -167,7 +168,7 @@ public void testZeroLengthPatch() throws Exception {
}
}

@Test(expectedExceptions = HttpResponseException.class, expectedExceptionsMessageRegExp = "Failed to connect to.*")
@Test(expectedExceptions = HttpResponseException.class, expectedExceptionsMessageRegExp = "Unable to find acceptable protocols.*")
public void testSSLConnectionFailsIfOnlyHttpConfigured() throws Exception {
MockWebServer server = mockWebServer(new MockResponse());
server.useHttps(sslSocketFactory(), false);
@@ -231,6 +232,15 @@ public void testRestrictedSSLProtocols() throws Exception {
}
}

protected static MockWebServer mockWebServer(MockResponse... responses) throws IOException {
MockWebServer server = new MockWebServer();
server.start(null, 0);
for (MockResponse response : responses) {
server.enqueue(response);
}
return server;
}

@ConfiguresHttpCommandExecutorService
private static final class ConnectionSpecModule extends AbstractModule {
private final List<ConnectionSpec> connectionSpecs;

0 comments on commit d7897b3

Please sign in to comment.