Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Commit

Permalink
8265297: javax/net/ssl/SSLSession/TestEnabledProtocols.java failed wi…
Browse files Browse the repository at this point in the history
…th "RuntimeException: java.net.SocketException: Connection reset"

Reviewed-by: xuelei, rhalade
  • Loading branch information
Fernando Guallini authored and rhalade committed Jun 17, 2021
1 parent 091bc4a commit 2047da7
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions test/jdk/javax/net/ssl/SSLSession/TestEnabledProtocols.java
Expand Up @@ -38,6 +38,7 @@
* @author Ram Marti
*/

import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.io.OutputStream;
Expand Down Expand Up @@ -136,22 +137,22 @@ protected void runClientApplication(SSLSocket sslSocket) throws Exception {
e.printStackTrace(System.out);
System.out.println("** Success **");
}
} catch (SSLException ssle) {
} catch (SSLException | SocketException se) {
// The server side may have closed the socket.
if (isConnectionReset(ssle)) {
System.out.println("Client SSLException:");
ssle.printStackTrace(System.out);
if (isConnectionReset(se)) {
System.out.println("Client SocketException:");
se.printStackTrace(System.out);
} else {
failTest(ssle, "Client got UNEXPECTED SSLException:");
failTest(se, "Client got UNEXPECTED Exception:");
}

} catch (Exception e) {
failTest(e, "Client got UNEXPECTED Exception:");
}
}

private boolean isConnectionReset(SSLException ssle) {
Throwable cause = ssle.getCause();
private boolean isConnectionReset(IOException ioe) {
Throwable cause = ioe instanceof SSLException se ? se.getCause() : ioe;
return cause instanceof SocketException
&& "Connection reset".equals(cause.getMessage());
}
Expand Down

1 comment on commit 2047da7

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.