'If the connection is cancelled before it finishes connecting, the
connection attempt is stopped.'

def test_connectionCancelledBeforeConnected(self):

    endpoint = SSHCommandClientEndpoint.newConnection(self.reactor, '/bin/ls    -l', 'dummy    user', self.hostname, self.port, knownHosts=self.knownHosts, ui=FixedResponseUI(False))
    factory = Factory()
    factory.protocol = Protocol
    d = endpoint.connect(factory)
    d.cancel()
    self.failureResultOf(d).trap(ConnectingCancelledError)
    self.assertTrue(self.reactor.connectors[0].stoppedConnecting)
