@Test
    public void shouldCloseIdleConnectionsAndRecreateNewConnections() throws InterruptedException {
        int idleMillis = 3000;
        final Cluster cluster = TestClientFactory.build()
                .idleConnectionTimeoutMillis(idleMillis)
                .create();
        final Client.ClusteredClient client = cluster.connect();
        client.init();
        final ExecutorService executorServiceForTesting = cluster.executor();

        try {
            // create or reuse some connections
            chooseConnections(3, client, executorServiceForTesting);

            // simulate downtime where there is no traffic so that all connections become idle
            TimeUnit.MILLISECONDS.sleep(idleMillis * 3);
            assertEquals(1, client.hostConnectionPools.size());
            // all connections should have been closed due to idle timeout
            assertTrue(client.hostConnectionPools.values().iterator().next().getPoolInfo().contains("no connections in pool"));

            // create or reuse some more connections
            chooseConnections(4, client, executorServiceForTesting);

        } finally {
            executorServiceForTesting.shutdown();
            client.close();
            cluster.close();
        }
    }
Added for TINKERPOP-2813 - this scenario would have previously thrown tons of
{@link NoHostAvailableException}.
gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/ClientConnectionIntegrateTest.java