add tlsConnect function
Merge branch 'master' into upstream