'A failed external IP lookup is retried (and the error logged).'

@capture_logging((lambda test, logger: assertHasAction(test, logger, LOG_GET_EXTERNAL_IP, False, {u'host': u'localhost', u'port': test.destination_port}, {u'exception': u'exceptions.RuntimeError'})))
def test_failed_get_external_ip(self, logger):

    original_connect = socket.socket.connect
    def fail_once(*args, **kwargs):
        socket.socket.connect = original_connect
        raise RuntimeError()
    self.patch(socket.socket, 'connect', fail_once)
    self.assertEqual(u'127.0.0.1', _get_external_ip(u'localhost', self.destination_port))
