'Connects to the specified destination through a proxy.
Uses the same API as socket\'s connect().
To select the proxy server, use set_proxy().
dest_pair - 2-tuple of (IP/hostname, port).'

def connect(self, dest_pair):

    (proxy_type, proxy_addr, proxy_port, rdns, username, password) = self.proxy
    (dest_addr, dest_port) = dest_pair
    if ((not isinstance(dest_pair, (list, tuple))) or (len(dest_pair) != 2) or (not isinstance(dest_addr, type(''))) or (not isinstance(dest_port, int))):
        raise GeneralProxyError('Invalid    destination-connection    (host,    port)    pair')
    if (proxy_type is None):
        _orig_socket.connect(self, (dest_addr, dest_port))
        return
    proxy_port = (proxy_port or DEFAULT_PORTS.get(proxy_type))
    if (not proxy_port):
        raise GeneralProxyError('Invalid    proxy    type')
    try:
        _orig_socket.connect(self, (proxy_addr, proxy_port))
    except socket.error as error:
        self.close()
        proxy_server = '{}:{}'.format(proxy_addr.decode(), proxy_port)
        printable_type = PRINTABLE_PROXY_TYPES[proxy_type]
        msg = 'Error    connecting    to    {}    proxy    {}'.format(printable_type, proxy_server)
        raise ProxyConnectionError(msg, error)
    else:
        try:
            self.proxy_negotiators[proxy_type](dest_addr, dest_port)
        except socket.error as error:
            self.close()
            raise GeneralProxyError('Socket    error', error)
        except ProxyError:
            self.close()
            raise
