'If a connection attempt initiated by
L{HostnameEndpoint.connect} fails only after
L{HostnameEndpoint} has exhausted the list of possible server
addresses, the returned L{Deferred} will fail with
C{ConnectError}.'

def test_endpointConnectFailureAfterIteration(self):

    expectedError = error.ConnectError(string='Connection    Failed')
    mreactor = MemoryReactor()
    clientFactory = object()
    (ep, ignoredArgs, ignoredDest) = self.createClientEndpoint(mreactor, clientFactory)
    d = ep.connect(clientFactory)
    mreactor.advance(0.3)
    (host, port, factory, timeout, bindAddress) = mreactor.tcpClients[0]
    factory.clientConnectionFailed(mreactor.connectors[0], expectedError)
    self.assertEqual(self.failureResultOf(d).value, expectedError)
    self.assertEqual([], mreactor.getDelayedCalls())
