'We try to protect the proxy from _accidentally_ connecting to itself,
e.g. because of a failed transparent lookup or an invalid configuration.'

def __check_self_connect(self):

    address = self.server_conn.address
    if address:
        self_connect = ((address[1] == self.config.options.listen_port) and (address[0] in ('localhost', '127.0.0.1', '::1')))
        if self_connect:
            raise exceptions.ProtocolException('Invalid    server    address:    {}\r\nThe    proxy    shall    not    connect    to    itself.'.format(repr(address)))
