Hello everyone.
What's the best way to find a NIOSSLHandler
in a ChannelPipeline
and is it somehow possible to get its SSL connection state?
Hello everyone.
What's the best way to find a NIOSSLHandler
in a ChannelPipeline
and is it somehow possible to get its SSL connection state?
The best way to find it is to use ChannelPipeline.handler(type:)
, assuming there is only one in the pipeline.
Thereโs currently no way to get the connection state: what information are you trying to obtain?
I'm working on a simple SMTP client and would like to make sure that when using STARTTLS (and therefore adding a NIOSSLClientHandler
to the pipeline), the SSL connection is properly established before sending any more data.
From my cursory reading, it seems that if adding the NIOSSLClientHandler
to the pipeline was successful, the SSL handshake has been performed and the connection is established. I'd just have liked to log the state somehow.
I've been looking at NIOSMTP, too, but trying to understand it all is an ongoing process. ;)
Happy Holidays!
There is a NIOTLS.handshakeCompleted
inbound user event that is fired when the TLS handshake completes, so if you wanted to log you could use that. However, once the SSLHandler is in the pipeline it will delay all data transfer until the handshake completes, so there is no need to wait for that signal.
Great; thank you very much!