Telnet is nice program that allows us to create a TCP socket connection with a server and then interact with the server on the terminal. This ofcourse does not work when the server uses SSL. That is where openssl comes to the rescue.
openssl s_client -connect imap.gmail.com:993
Similarly an SSL server can be cooked up instantaneously -