Skip to content

Commit

Permalink
fix failed testSSLConnectionFailsIfOnlyHttpConfigured
Browse files Browse the repository at this point in the history
  • Loading branch information
korlov42 authored and gaul committed Feb 12, 2021
1 parent d74dcca commit d7897b3
Showing 1 changed file with 11 additions and 1 deletion.
Expand Up @@ -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;

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

0 comments on commit d7897b3

Please sign in to comment.