def _test_connect_to_host(self, url, host):
        """Check that a ProberFactory created with the given url will actually
        connect to the given host.
        """
        prober = ProberFactory(url)

        def fakeConnect(host, port, factory):
            factory.connecting_to = host
            factory.succeeded('200')

        prober.connecting_to = None
        orig_connect = reactor.connectTCP
        reactor.connectTCP = fakeConnect

        def restore_connect(result, orig_connect):
            self.failUnlessEqual(prober.connecting_to, host)
            reactor.connectTCP = orig_connect
            return None

        deferred = prober.probe()
        return deferred.addCallback(restore_connect, orig_connect)
    def _test_connect_to_host(self, url, host):
        """Check that a ProberFactory created with the given url will actually
        connect to the given host.
        """
        prober = ProberFactory(url)

        def fakeConnect(host, port, factory):
            factory.connecting_to = host
            factory.succeeded('200')

        prober.connecting_to = None
        orig_connect = reactor.connectTCP
        reactor.connectTCP = fakeConnect

        def restore_connect(result, orig_connect):
            self.failUnlessEqual(prober.connecting_to, host)
            reactor.connectTCP = orig_connect
            return None

        deferred = prober.probe()
        return deferred.addCallback(restore_connect, orig_connect)