Add optional connect/SSL handshake timeouts

This adds optional timeouts for establishing connections and completing an SSL handshake.