I have a (legacy) solution written several years ago in VB.net which is an SMTP server. Part of the solution includes responding to the STARTTLS command which effectively converts the active client socket from plain to SSL.
I'm looking to convert this to B4J, and have created a very simple server based on MJPEG_CCTV with a ServerSocket, and the custom client class.
Can a client be converted from plain to SSL whilst connected?
These are the logs of a minimal implementation of SMTP client with STARTTLS. It requires an update to AsyncStreams as we need to stop it without closing the underlying sockets.
I will post it tomorrow.
Upgrading from a non-tls connection to a tls connection only makes sense when dealing with a protocol that specifically requires it. It is much simpler and also a bit more secure to start with a TLS connection, instead of upgrading it after the connection is made. The most common case for this...
www.b4x.com
I haven't tested it in server mode. It might required setting setUseClientMode to False (see the comment in the code).