--- a/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java Thu Nov 13 23:08:11 2008 -0800
+++ b/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java Thu Nov 13 23:25:10 2008 -0800
@@ -1012,6 +1012,22 @@
*/
ServerHandshaker getServerHandshaker() throws SSLException {
initHandshaker();
+
+ // The connection state would have been set to cs_HANDSHAKE during the
+ // handshaking initializing, however the caller may not have the
+ // the low level connection's established, which is not consistent with
+ // the HANDSHAKE state. As if it is unconnected, we need to reset the
+ // connection state to cs_START.
+ if (!isConnected()) {
+ connectionState = cs_START;
+ }
+
+ // Make sure that we get a ServerHandshaker.
+ // This should never happen.
+ if (!(handshaker instanceof ServerHandshaker)) {
+ throw new SSLProtocolException("unexpected handshaker instance");
+ }
+
return (ServerHandshaker)handshaker;
}
@@ -1273,7 +1289,8 @@
}
}
- private void closeSocket() throws IOException {
+ protected void closeSocket() throws IOException {
+
if ((debug != null) && Debug.isOn("ssl")) {
System.out.println(threadName() + ", called closeSocket()");
}