This originally appeared on the Annexe.

Using OpenSSL:

openssl s_client -connect hostname.tld:443

And if you’re testing an xmpp server:

openssl s_client -connect hostname.tld:5222 -starttls xmpp

Use the -ssl3 command if you know you’re dealing with an older server.