Failing to establish TLS when using Java 11
When using Java 11, some TLS sessions fail to get established properly. Exceptions like these are logged:
The remote peer perceives this as a timeout.
Netty does something similar as what we did for - but checks for more messages to swallow: https://github.com/netty/netty/blob/41b02368153af86b1ddb19020ebf5e4f7c69aecd/handler/src/main/java/io/netty/handler/ssl/SslHandler.java#L1779
There appears to be a very similar issue being discussed here: https://bugs.openjdk.java.net/browse/JDK-8215102?focusedCommentId=14240050&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-14240050
This looks like something similar to OF-1009. It appears that sockets are being closed "to soon", which causes an exception.
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/javax/net/ssl/SSLSocket.html hints at there being a proper way to close sessions:
When the connection is no longer needed, the client and server applications should each close both sides of their respective connection. For SSLSocket objects, for example, an application can call Socket.shutdownOutput()or OutputStream.close() for output strean close and call Socket.shutdownInput() or InputStream.close() for input stream close. Note that in some cases, closing the input stream may depend on the peer's output stream being closed first. If the connection is not closed in an orderly manner (for example Socket.shutdownInput() is called before the peer's write closure notification has been received), exceptions may be raised to indicate that an error has occurred. Once an SSLSocket is closed, it is not reusable: a new SSLSocket must be created.