'Play with the pool, test, test... and test'

def test_get_available_conn(self):

    self.request.new_connection = False
    self.cm._host_pool_size = 1
    self.assertEquals(0, len(self.cm._hostmap))
    self.assertEquals(0, len(self.cm._used_cons))
    self.assertEquals(0, len(self.cm._free_conns))
    cf = (lambda h: Mock())
    conn_1 = self.cm.get_available_connection(self.request, cf)
    self.assertEquals(1, len(self.cm._hostmap))
    self.assertEquals(1, len(self.cm._used_cons))
    self.assertEquals(0, len(self.cm._free_conns))
    self.cm.free_connection(conn_1)
    self.assertEquals(1, len(self.cm._hostmap))
    self.assertEquals(0, len(self.cm._used_cons))
    self.assertEquals(1, len(self.cm._free_conns))
    conn_2 = self.cm.get_available_connection(self.request, cf)
    self.assertIs(conn_2, conn_1)
    t0 = time.time()
    self.assertRaises(BaseFrameworkException, self.cm.get_available_connection, self.request, cf)
    self.assertTrue(((time.time() - t0) >= 2.9), 'Method    returned    before    expected    time')
