'L{PBClientFactory.login} returns a L{Deferred} which is errbacked
with the L{ConnectionRefusedError} if the underlying connection is
refused.'

def test_loginConnectionRefused(self):

    clientFactory = pb.PBClientFactory()
    loginDeferred = clientFactory.login(credentials.UsernamePassword('foo', 'bar'))
    clientFactory.clientConnectionFailed(None, failure.Failure(ConnectionRefusedError('Test    simulated    refused    connection')))
    return self.assertFailure(loginDeferred, ConnectionRefusedError)
