@Test
  public void testConnectionChore() throws Exception {
    // 1s for clean interval & 5s for maxIdleTime
    ConnectionCache cache = new ConnectionCache(UTIL.getConfiguration(),
      UserProvider.instantiate(UTIL.getConfiguration()), 1000, 5000);
    ConnectionCache.ConnectionInfo info = cache.getCurrentConnection();

    assertEquals(false, info.connection.isClosed());

    Thread.sleep(7000);

    assertEquals(true, info.connection.isClosed());
  }
test for ConnectionCache cleaning expired Connection
hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestConnectionCache.java