mirror of https://github.com/apache/jclouds.git
fix failed testSSLConnectionFailsIfOnlyHttpConfigured
This commit is contained in:
parent
d74dcca6dd
commit
d7897b3d25
|
@ -24,6 +24,7 @@ import static org.testng.Assert.assertEquals;
|
|||
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 class OkHttpCommandExecutorServiceTest extends BaseHttpCommandExecutorSer
|
|||
}
|
||||
}
|
||||
|
||||
@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 class OkHttpCommandExecutorServiceTest extends BaseHttpCommandExecutorSer
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue