@Test
public void testThreadIsNotAffectedByBlockingInAnotherThread() {

    final AtomicBoolean aDone = new AtomicBoolean(false);
    final AtomicBoolean aSelfDone = new AtomicBoolean(false);
    final AtomicBoolean bDone = new AtomicBoolean(false);
    Thread a = new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                service.await(new Runnable() {
                    @Override
                    public void run() {
                        while (!aDone.get()) {
                            continue;
                        }
                        aSelfDone.set(true);
                    }
                });
            }
            catch (InterruptedException e) {
                throw CheckedExceptions.wrapAsRuntimeException(e);
            }
        }
    });
    Thread b = new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                service.await(new Runnable() {
                    @Override
                    public void run() {
                        Threads.sleep(100);
                    }
                }, new Runnable() {
                    @Override
                    public void run() {
                        Threads.sleep(50);
                    }
                }, new Runnable() {
                    @Override
                    public void run() {
                        Threads.sleep(150);
                    }
                });
            }
            catch (InterruptedException e) {
                throw CheckedExceptions.wrapAsRuntimeException(e);
            }
            bDone.set(true);
        }
    });
    a.start();
    b.start();
    Threads.sleep(300); // b should take no longer than this
    Assert.assertTrue(bDone.get());
    Assert.assertFalse(aSelfDone.get());
    aDone.set(true);
    Threads.sleep(10);
    Assert.assertTrue(aSelfDone.get());
}