final TimeUnit tunit) throws InterruptedException, ConnectionPoolTimeoutException {
connLatch.countDown(); // notify waiter that we're getting a connection
// zero usually means sleep forever, but CountDownLatch doesn't interpret it that way.
if(!awaitLatch.await(timeout > 0 ? timeout : Integer.MAX_VALUE, tunit)) {
throw new ConnectionPoolTimeoutException();
}
return Mockito.mock(HttpClientConnection.class);
}
};