diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/SSLStreams.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/SSLStreams.java index 6e362d07aa4ad..e67de1fa4f5bf 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/SSLStreams.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/SSLStreams.java @@ -430,11 +430,16 @@ void doClosure () throws IOException { handshaking.lock(); ByteBuffer tmp = allocate(BufType.APPLICATION); WrapperResult r; + Status st; + HandshakeStatus hs; do { tmp.clear(); tmp.flip (); r = wrapper.wrapAndSendX (tmp, true); - } while (r.result.getStatus() != Status.CLOSED); + hs = r.result.getHandshakeStatus(); + st = r.result.getStatus(); + } while (st != Status.CLOSED && + !(st == Status.OK && hs == HandshakeStatus.NOT_HANDSHAKING)); } finally { handshaking.unlock(); }