@Test
public void testOverlappingLockSpinsInSameJvm()
        throws InterruptedException {

    FileChannel channel = randomFileChannel();
    CountDownLatch latch = new CountDownLatch(2);
    Thread a = new Thread(() -> {
        FileLock lock = FileLocks.lock(channel, 0, 10, false);
        Random.tinySleep();
        latch.countDown();
        FileLocks.release(lock);
    });
    Thread b = new Thread(() -> {
        FileLock lock = FileLocks.lock(channel, 3, 8, false);
        Random.tinySleep();
        latch.countDown();
        FileLocks.release(lock);
    });
    a.start();
    b.start();
    latch.await();
    Assert.assertTrue(true);
}