'L{ClientCreator.connectTCP} inserts a very short delayed call between
the time the connection is established and the time the L{Deferred}
returned from one of its connect methods actually fires.  If the
L{Deferred} is cancelled in this interval, the established connection is
closed, the timeout is cancelled, and the L{Deferred} fails with
L{CancelledError}.'

def test_cancelConnectTCPTimeout(self):

    def connect(reactor, cc):
        d = cc.connectTCP('example.com', 1234)
        (host, port, factory, timeout, bindAddress) = reactor.tcpClients.pop()
        protocol = factory.buildProtocol(None)
        transport = StringTransport()
        protocol.makeConnection(transport)
        return d
    return self._cancelConnectTimeoutTest(connect)
