'Like L{_cancelConnectTest}, but for the case where the L{Deferred} is
cancelled after the connection is set up but before it is fired with the
resulting protocol instance.'

def _cancelConnectTimeoutTest(self, connect):

    reactor = MemoryReactorClock()
    cc = ClientCreator(reactor, Protocol)
    d = connect(reactor, cc)
    connector = reactor.connectors.pop()
    self.assertEqual(len(reactor.getDelayedCalls()), 1)
    d.cancel()
    self.assertEqual(reactor.getDelayedCalls(), [])
    self.assertTrue(connector._disconnected)
    return self.assertFailure(d, CancelledError)
