8265297: javax/net/ssl/SSLSession/TestEnabledProtocols.java failed with "RuntimeException: java.net.SocketException: Connection reset"
Reviewed-by: xuelei, rhalade
This commit is contained in:
parent
091bc4a1a6
commit
2047da7dcc
@ -38,6 +38,7 @@
|
|||||||
* @author Ram Marti
|
* @author Ram Marti
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InterruptedIOException;
|
import java.io.InterruptedIOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
@ -136,13 +137,13 @@ public class TestEnabledProtocols extends SSLSocketTemplate {
|
|||||||
e.printStackTrace(System.out);
|
e.printStackTrace(System.out);
|
||||||
System.out.println("** Success **");
|
System.out.println("** Success **");
|
||||||
}
|
}
|
||||||
} catch (SSLException ssle) {
|
} catch (SSLException | SocketException se) {
|
||||||
// The server side may have closed the socket.
|
// The server side may have closed the socket.
|
||||||
if (isConnectionReset(ssle)) {
|
if (isConnectionReset(se)) {
|
||||||
System.out.println("Client SSLException:");
|
System.out.println("Client SocketException:");
|
||||||
ssle.printStackTrace(System.out);
|
se.printStackTrace(System.out);
|
||||||
} else {
|
} else {
|
||||||
failTest(ssle, "Client got UNEXPECTED SSLException:");
|
failTest(se, "Client got UNEXPECTED Exception:");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -150,8 +151,8 @@ public class TestEnabledProtocols extends SSLSocketTemplate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isConnectionReset(SSLException ssle) {
|
private boolean isConnectionReset(IOException ioe) {
|
||||||
Throwable cause = ssle.getCause();
|
Throwable cause = ioe instanceof SSLException se ? se.getCause() : ioe;
|
||||||
return cause instanceof SocketException
|
return cause instanceof SocketException
|
||||||
&& "Connection reset".equals(cause.getMessage());
|
&& "Connection reset".equals(cause.getMessage());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user