Hi, Please find below a fix for:
8221395: HttpClient leaving connections in CLOSE_WAIT state until Java process ends https://bugs.openjdk.java.net/browse/JDK-8221395 Webrev: http://cr.openjdk.java.net/~dfuchs/webrev_8221395/webrev.00/ HttpConnection has a high level isOpen() accessor that tells whether the connection is opened. However, in the case of HTTPS, isOpen() can be false even though the underlying socket channel hasn't been closed yet. When checking whether a connection should be returned to the pool, we want to check whether the connection is still opened before returning it to the pool. That code makes the wrong assumption that if isOpen() returns false the connection doesn't need to be closed. This proposed change fixes that. It includes a whitebox test that checks that the `HttpConnection::closeOrReturnToPool` method will close the connection in all the cases were the connection is not returned to the pool. The test fails with the expected exception without the fix, and passes with it. -- daniel