You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2021/02/12 09:57:57 UTC

[jclouds] 03/06: fix failed testSSLConnectionFailsIfOnlyHttpConfigured

This is an automated email from the ASF dual-hosted git repository.

gaul pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jclouds.git

commit d7897b3d25816d2ca2b35e4af7bb573ef2eb3d14
Author: korlov42 <ko...@gridgain.com>
AuthorDate: Fri Oct 9 23:25:48 2020 +0300

    fix failed testSSLConnectionFailsIfOnlyHttpConfigured
---
 .../http/okhttp/OkHttpCommandExecutorServiceTest.java        | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/okhttp/src/test/java/org/jclouds/http/okhttp/OkHttpCommandExecutorServiceTest.java b/drivers/okhttp/src/test/java/org/jclouds/http/okhttp/OkHttpCommandExecutorServiceTest.java
index 877cf88..bf67b0b 100644
--- a/drivers/okhttp/src/test/java/org/jclouds/http/okhttp/OkHttpCommandExecutorServiceTest.java
+++ b/drivers/okhttp/src/test/java/org/jclouds/http/okhttp/OkHttpCommandExecutorServiceTest.java
@@ -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;