geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject [geode] branch develop updated: GEODE-2059 client SSL handshake attempts do not time out
Date Mon, 04 Mar 2019 19:41:14 GMT
This is an automated email from the ASF dual-hosted git repository.

bschuchardt pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new e77145b  GEODE-2059 client SSL handshake attempts do not time out
e77145b is described below

commit e77145bd7d55b72770ce041d5d859ae3333f432c
Author: Bruce Schuchardt <bschuchardt@pivotal.io>
AuthorDate: Mon Mar 4 11:39:32 2019 -0800

    GEODE-2059 client SSL handshake attempts do not time out
    
    Updating tests to allow an SSLException with cause
    SocketTimeoutException.
---
 .../geode/internal/net/SSLSocketIntegrationTest.java     | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java
b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java
index 5e81b83..8e27671 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java
@@ -53,6 +53,7 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 
 import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLException;
 
 import org.apache.commons.io.FileUtils;
 import org.junit.After;
@@ -71,6 +72,7 @@ import org.apache.geode.distributed.internal.DistributionConfigImpl;
 import org.apache.geode.internal.ByteBufferOutputStream;
 import org.apache.geode.internal.security.SecurableCommunicationChannel;
 import org.apache.geode.internal.tcp.ByteBufferInputStream;
+import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.junit.categories.MembershipTest;
 
 /**
@@ -112,6 +114,8 @@ public class SSLSocketIntegrationTest {
 
   @Before
   public void setUp() throws Exception {
+    IgnoredException.addIgnoredException("javax.net.ssl.SSLException: Read timed out");
+
     File keystore = findTestKeystore();
     System.setProperty("javax.net.ssl.trustStore", keystore.getCanonicalPath());
     System.setProperty("javax.net.ssl.trustStorePassword", "password");
@@ -324,6 +328,10 @@ public class SSLSocketIntegrationTest {
     socket.connect(new InetSocketAddress(localHost, serverPort));
     await().untilAsserted(() -> assertFalse(serverThread.isAlive()));
     assertNotNull(serverException);
+    if (serverException instanceof SSLException
+        && serverException.getCause() instanceof SocketTimeoutException) {
+      throw serverException.getCause();
+    }
     throw serverException;
   }
 
@@ -401,11 +409,15 @@ public class SSLSocketIntegrationTest {
           System.err.println(
               "client successfully connected to server but should not have been able to do
so");
           return false;
-        } catch (SocketTimeoutException e) {
+        } catch (SSLException | SocketTimeoutException e) {
+          IOException ioException = e;
           // we need to verify that this timed out in the handshake
           // code
+          if (e instanceof SSLException && e.getCause() instanceof SocketTimeoutException)
{
+            ioException = (SocketTimeoutException) ioException.getCause();
+          }
           System.out.println("client connect attempt timed out - checking stack trace");
-          StackTraceElement[] trace = e.getStackTrace();
+          StackTraceElement[] trace = ioException.getStackTrace();
           for (StackTraceElement element : trace) {
             if (element.getMethodName().equals("configureClientSSLSocket")) {
               System.out.println("client connect attempt timed out in the appropriate method");


Mime
View raw message