Skip to content

Commit dd09bad

Browse files
committed
Fix potential test failure
1 parent df3f762 commit dd09bad

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/org/apache/tomcat/util/net/ocsp/TestOcspTimeout.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*/
1717
package org.apache.tomcat.util.net.ocsp;
1818

19+
import java.net.SocketException;
20+
1921
import javax.net.ssl.SSLHandshakeException;
2022

2123
import org.junit.AfterClass;
@@ -60,6 +62,15 @@ public void testTimeoutWithSoftFail() throws Exception {
6062

6163
@Test(expected = SSLHandshakeException.class)
6264
public void testTimeoutWithoutSoftFail() throws Exception {
63-
doTest(false, false, ClientCertificateVerification.ENABLED, false, Boolean.FALSE);
65+
try {
66+
doTest(false, false, ClientCertificateVerification.ENABLED, false, Boolean.FALSE);
67+
} catch (SocketException se) {
68+
// NIO2 may throw a SocketException rather than a SSLHandshakeException
69+
if (getTomcatInstance().getConnector().getProtocolHandlerClassName().contains("Nio2")) {
70+
throw new SSLHandshakeException(se.getMessage());
71+
} else {
72+
throw se;
73+
}
74+
}
6475
}
6576
}

0 commit comments

Comments
 (0)