SslConnection

Extends NetConnection, implements an Ssl connection over Tcp.

How it works

For client side connection:

  • the application calls Connect on the SslConnection.
  • if Tcp connect fails, the application is notified by CloseHandler. STOP.
  • the SSL handshake takes place
  • if the handshake fails, the application is notified by CloseHandler. STOP.
  • on handshake success, the application is notified by ConnectHandler. STOP.

A fully connected SslConnection can be used like any generic NetConnection.

When the application wishes to close the connection, it may call either:

  • ForceClose. Gracefully closes the SSL connection.
  • FlushAndClose. Instantly (forcefully) closes the SSL connection.
    In both cases the application receives a CloseHandler(CLOSE_READ_WRITE) notification.

If the peer closes the connection, the application receives a CloseHandler(CLOSE_READ_WRITE) notification.