@Test
public void testInlineExecution()
        throws Exception
{

    AsyncSemaphore<Runnable> asyncSemaphore = new AsyncSemaphore<>(1, executor, task -> newDirectExecutorService().submit(task));
    final AtomicInteger count = new AtomicInteger();
    List<ListenableFuture<?>> futures = new ArrayList<>();
    for (int i = 0; i < 1000; i++) {
        futures.add(asyncSemaphore.submit(count::incrementAndGet));
    }
    // Wait for completion
    Futures.allAsList(futures).get(1, TimeUnit.MINUTES);
    Assert.assertEquals(count.get(), 1000);
}