'Connect to a host on a given (SSL) port.'

def connect(self):

    if (self.proxy_info and self.proxy_info.isgood()):
        sock = socks.socksocket(socket.AF_INET, socket.SOCK_STREAM)
        sock.setproxy(*self.proxy_info.astuple())
    else:
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    if has_timeout(self.timeout):
        sock.settimeout(self.timeout)
    sock.connect((self.host, self.port))
    self.sock = _ssl_wrap_socket(sock, self.key_file, self.cert_file)
