'When getting connections out of the cache, disconnected connections
are removed and not returned.'

def test_getSkipsDisconnected(self):

    pool = self.pool
    key = ('http', 'example.com', 80)
    origCached = [StubHTTPProtocol(), StubHTTPProtocol()]
    for p in origCached:
        p.makeConnection(StringTransport())
        pool._putConnection(key, p)
    self.assertEqual(pool._connections[key], origCached)
    origCached[0].state = 'DISCONNECTED'
    result = []
    self.pool.getConnection(key, BadEndpoint()).addCallback(result.append)
    self.assertIdentical(result[0], origCached[1])
    self.assertEqual(pool._connections[key], [])
    self.assertEqual(pool._timeouts, {})
