8166878: Connection reset during TLS handshake
Reviewed-by: xuelei
Contributed-by: xuelei.fan@oracle.com
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java Thu Oct 06 10:31:41 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java Sun Oct 09 14:38:30 2016 +0300
@@ -673,8 +673,11 @@
} else {
// we wanted to resume, but the server refused
//
- // Invalidate the session in case of reusing next time.
- session.invalidate();
+ // Invalidate the session for initial handshake in case
+ // of reusing next time.
+ if (isInitialHandshake) {
+ session.invalidate();
+ }
session = null;
if (!enableNewSession) {
throw new SSLException("New session creation is disabled");