java.net.Socket has legacy support that attempts to read bytes in the socket buffer after a connection reset has been detected. This doesn't make any sense on most platforms and is too fragile/unpredictable on the few where this is possible. This code should be removed. The implementation also has code to ensure a consistent exception is thrown for cases where code attempts to read from a socket after "connection reset" has been reported. It's possible that code is relying on this behavior so that needs to be retained.