IdleConnectionReaper extends Thread { @Deprecated public static boolean registerConnectionManager(HttpClientConnectionManager connectionManager) { return registerConnectionManager(connectionManager, DEFAULT_MAX_IDLE_MILLIS); } private  IdleConnectionReaper(); @Deprecated static boolean registerConnectionManager(HttpClientConnectionManager connectionManager); static boolean registerConnectionManager(HttpClientConnectionManager connectionManager, long maxIdleInMs); static boolean removeConnectionManager(HttpClientConnectionManager connectionManager); @SdkTestInternalApi static List<HttpClientConnectionManager> getRegisteredConnectionManagers(); static synchronized boolean shutdown(); @SuppressWarnings("unchecked") @Override void run();  }
@Test public void maxIdle_HonoredOnClose() throws InterruptedException { HttpClientConnectionManager connectionManager = mock(HttpClientConnectionManager.class); final long idleTime = 10 * 1000; IdleConnectionReaper.registerConnectionManager(connectionManager, idleTime); verify(connectionManager, timeout(90 * 1000)).closeIdleConnections(eq(idleTime), eq(TimeUnit.MILLISECONDS)); }