--- old/test/jdk/sun/net/www/protocol/https/TestHttpsServer.java 2019-08-13 16:22:29.000000000 +0100 +++ new/test/jdk/sun/net/www/protocol/https/TestHttpsServer.java 2019-08-13 16:22:29.000000000 +0100 @@ -316,6 +316,7 @@ HttpCallback cb; HandshakeStatus currentHSStatus; boolean initialHSComplete; + boolean handshakeStarted; /* * All inbound data goes through this buffer. * @@ -372,7 +373,19 @@ * be generated here. */ inNetBB.flip(); - result = sslEng.unwrap(inNetBB, inAppBB); + try { + result = sslEng.unwrap(inNetBB, inAppBB); + if (bytes > 0) handshakeStarted = true; + } catch(SSLException se) { + // Sometime a rogue client may try to open a plain + // connection with our server. Calling this method + // gives a chance to the test logic to ignore such + // rogue connections. + if (!handshakeStarted && cb.closeOnException(se)) { + try { schan.close(); } catch (IOException x) { }; + return; + } else throw se; + } inNetBB.compact(); currentHSStatus = result.getHandshakeStatus();