'Establishes a server connection.
Must not be called if there is an existing connection.
Raises:
~mitmproxy.exceptions.ProtocolException: if the connection could not be established.'

def connect(self):

    if (not self.server_conn.address):
        raise exceptions.ProtocolException('Cannot    connect    to    server,    no    server    address    given.')
    self.log('serverconnect', 'debug', [repr(self.server_conn.address)])
    self.channel.ask('serverconnect', self.server_conn)
    try:
        self.server_conn.connect()
    except exceptions.TcpException as e:
        raise exceptions.ProtocolException('Server    connection    to    {}    failed:    {}'.format(repr(self.server_conn.address), str(e)))
