OpenSSL Connection Time Out

Okay so I am running a command like

openssl s_client  -showcerts -connect mail.google.com:443

What happens is that it takes about 2 or 3 minutes for the connection to time out and for the script to move on. I can't figure out how to decrease the amount of time it takes for the connection to time out.

Following This link, you could try any of the following..

echo "QUIT" | openssl s_client -showcerts -connect gmail.google.com:443

or

openssl s_client -showcerts -connect gmail.google.com:443 < /dev/null

Hope it helps.