@Test
public void testRateLimitTryAcquisition() throws InterruptedException {

  try (RateLimiter rateLimiter = new RateLimiter(10, Duration.ofSeconds(1), 10)) {
    LOG.debug("Rate Limiter = {}", rateLimiter);
    Assert.assertFalse(rateLimiter.tryAcquire(20, 0, TimeUnit.MILLISECONDS));
    long startTime = TimeSource.nanoTime();
    boolean tryAcquire = rateLimiter.tryAcquire(20, 2, TimeUnit.SECONDS);
    LOG.debug("waited {} ns for {}", (TimeSource.nanoTime() - startTime), rateLimiter);
    Assert.assertTrue(tryAcquire);
    Assert.assertFalse(rateLimiter.tryAcquire(20, 1, TimeUnit.SECONDS));
  }
}