@SuppressWarnings("unchecked")
    @Override
    public void run() {
        while (!shuttingDown) {
            try {
                for (Map.Entry<HttpClientConnectionManager, Long> entry : connectionManagers.entrySet()) {
                    // When we release connections, the connection manager leaves them
                    // open so they can be reused.  We want to close out any idle
                    // connections so that they don't sit around in CLOSE_WAIT.
                    try {
                        entry.getKey().closeIdleConnections(entry.getValue(), TimeUnit.MILLISECONDS);
                    } catch (Exception t) {
                        LOG.warn("Unable to close idle connections", t);
                    }
                }

                Thread.sleep(PERIOD_MILLISECONDS);
            } catch (Throwable t) {
                LOG.debug("Reaper thread: ", t);
            }
        }

        LOG.debug("Shutting down reaper thread.");
    }
For testing purposes.
Returns the number of connection managers currently monitored by this
reaper.
aws-java-sdk-core/src/main/java/com/amazonaws/http/IdleConnectionReaper.java