factor out creation of socket
first stab at HTTPS_PROXY implementation