@Override
    public Optional<Listener> acquire(ContextT context) {
        return tryAcquire(context).map(delegate -> new Listener() {
            @Override
            public void onSuccess() {
                delegate.onSuccess();
                unblock();
            }

            @Override
            public void onIgnore() {
                delegate.onIgnore();
                unblock();
            }

            @Override
            public void onDropped() {
                delegate.onDropped();
                unblock();
            }
        });
    }
@Test
    public void blockWhenFullAndTimeout() {
        // Acquire all 4 available tokens
        for (int i = 0; i < 4; i++) {
            Optional<Limiter.Listener> listener = blockingLimiter.acquire(null);
            Assert.assertTrue(listener.isPresent());
        }

        // Next acquire will block for 1 second
        long start = System.nanoTime();
        Optional<Limiter.Listener> listener = blockingLimiter.acquire(null);
        long duration = TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - start);
        Assert.assertTrue(duration >= 1);
        Assert.assertFalse(listener.isPresent());
    }