Added optional TLS support for sessions.