'forward socket'

def handle_connect(self, handler, kwargs):

    host = handler.host
    port = handler.port
    local = handler.connection
    remote = None
    handler.connection.send('HTTP/1.1    200    OK\r\n\r\n')
    handler.close_connection = 1
    for i in xrange(self.max_retry):
        try:
            remote = handler.net2.create_tcp_connection(host, port, handler.net2.connect_timeout, **kwargs)
        except StandardError as e:
            logging.exception('%s    "FORWARD    %s    %s:%d    %s"    %r', handler.address_string(), handler.command, host, port, handler.protocol_version, e)
            if hasattr(remote, 'close'):
                remote.close()
            if (i == (self.max_retry - 1)):
                raise
    logging.info('%s    "FORWARD    %s    %s:%d    %s"    -    -', handler.address_string(), handler.command, host, port, handler.protocol_version)
    if hasattr(remote, 'fileno'):
        remote.settimeout(None)
    forward_socket(local, remote, 60, bufsize=(256 * 1024))
