@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 adaptWhenLimitDecreases() {
        List<Optional<Limiter.Listener>> listeners = acquireN(blockingLimiter, 4);

        limit.setLimit(3);

        listeners.get(0).get().onSuccess();

        // Next acquire will reject and block
        long start = System.nanoTime();
        Optional<Limiter.Listener> listener = blockingLimiter.acquire(null);
        long duration = TimeUnit.SECONDS.toMillis(System.nanoTime() - start);
        Assert.assertTrue("Duration = " + duration, duration >= 1);
        Assert.assertFalse(listener.isPresent());
    }