'Getting an address which has a cached connection returns the cached
connection, removes it from the cache and cancels its timeout.'

def test_getCachedConnection(self):

    protocol = StubHTTPProtocol()
    protocol.makeConnection(StringTransport())
    self.pool._putConnection(('http', 'example.com', 80), protocol)
    def gotConnection(conn):
        self.assertIdentical(protocol, conn)
        self.assertNotIn(conn, self.pool._connections[('http', 'example.com', 80)])
        self.fakeReactor.advance(241)
        self.assertEqual(conn.transport.disconnecting, False)
        self.assertNotIn(conn, self.pool._timeouts)
    return self.pool.getConnection(('http', 'example.com', 80), BadEndpoint()).addCallback(gotConnection)
