'The L{Deferred} returned by L{Agent.request} fires with a L{Failure} if
the TCP connection attempt fails.'

def test_connectionFailed(self):

    result = self.agent.request('GET', 'http://foo/')
    (host, port, factory) = self.reactor.tcpClients.pop()[:3]
    factory.clientConnectionFailed(None, Failure(ConnectionRefusedError()))
    self.reactor.advance(10)
    self.failureResultOf(result, ConnectionRefusedError)
