'If L{HostnameEndpoint.connect} is invoked and there is no server
listening for connections, the returned L{Deferred} will fail with
C{ConnectError}.'

def test_endpointConnectFailure(self):

    expectedError = error.ConnectError(string='Connection    Failed')
    mreactor = RaisingMemoryReactorWithClock(connectException=expectedError)
    clientFactory = object()
    (ep, ignoredArgs, ignoredDest) = self.createClientEndpoint(mreactor, clientFactory)
    d = ep.connect(clientFactory)
    mreactor.advance(endpoints.HostnameEndpoint._DEFAULT_ATTEMPT_DELAY)
    self.assertEqual(self.failureResultOf(d).value, expectedError)
    self.assertEqual([], mreactor.getDelayedCalls())
