'If a connection cannot be established, the L{Deferred} returned by
L{SSHCommandClientEndpoint.connect} fires with a L{Failure}
representing the reason for the connection setup failure.'

def test_connectionFailed(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)
    factory = self.reactor.tcpClients[0][2]
    factory.clientConnectionFailed(None, Failure(ConnectionRefusedError()))
    self.failureResultOf(d).trap(ConnectionRefusedError)
