mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-07 22:50:49 +00:00
8331334: com/sun/net/httpserver/HttpsParametersClientAuthTest.java fails in testServerNeedClientAuth(false)
Reviewed-by: dfuchs
This commit is contained in:
parent
b91083341a
commit
8af606fb8c
@ -50,6 +50,7 @@ import com.sun.net.httpserver.HttpHandler;
|
||||
import com.sun.net.httpserver.HttpsConfigurator;
|
||||
import com.sun.net.httpserver.HttpsParameters;
|
||||
import com.sun.net.httpserver.HttpsServer;
|
||||
import jdk.internal.util.OperatingSystem;
|
||||
import jdk.test.lib.net.SimpleSSLContext;
|
||||
import jdk.test.lib.net.URIBuilder;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -68,12 +69,14 @@ import static org.junit.jupiter.api.Assertions.fail;
|
||||
* @bug 8326381
|
||||
* @summary verifies that the setNeedClientAuth() and setWantClientAuth()
|
||||
* methods on HttpsParameters class work as expected
|
||||
* @modules java.base/jdk.internal.util
|
||||
* @library /test/lib
|
||||
* @build jdk.test.lib.net.SimpleSSLContext jdk.test.lib.net.URIBuilder
|
||||
* @run junit HttpsParametersClientAuthTest
|
||||
*/
|
||||
public class HttpsParametersClientAuthTest {
|
||||
|
||||
private static final boolean IS_WINDOWS = OperatingSystem.isWindows();
|
||||
private static final AtomicInteger TID = new AtomicInteger();
|
||||
private static final ThreadFactory SRV_THREAD_FACTORY = (r) -> {
|
||||
final Thread t = new Thread(r);
|
||||
@ -220,9 +223,11 @@ public class HttpsParametersClientAuthTest {
|
||||
throw ioe;
|
||||
}
|
||||
// verify it failed due to right reason
|
||||
Throwable cause = ioe;
|
||||
Throwable cause = ioe.getCause();
|
||||
while (cause != null) {
|
||||
// either of SocketException or SSLHandshakeException are OK
|
||||
// either of SocketException or SSLHandshakeException are OK.
|
||||
// additionally on Windows we accept even IOException
|
||||
// (caused by WSAECONNABORTED)
|
||||
if (cause instanceof SocketException se) {
|
||||
final String msg = se.getMessage();
|
||||
assertTrue(msg != null && msg.contains("Connection reset"),
|
||||
@ -235,6 +240,12 @@ public class HttpsParametersClientAuthTest {
|
||||
"unexpected message in SSLHandshakeException: " + msg);
|
||||
System.out.println("received the expected exception: " + she);
|
||||
break;
|
||||
} else if (IS_WINDOWS && cause instanceof IOException winIOE) {
|
||||
// on Windows we sometimes receive this exception, which is
|
||||
// acceptable
|
||||
System.out.println("(windows) received the expected exception: "
|
||||
+ winIOE);
|
||||
break;
|
||||
}
|
||||
cause = cause.getCause();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user