private static void assertClosed(Future<?> future) throws Throwable {
    try {
      future.get(10, SECONDS);
      fail("ChannelClosedException was not thrown");
    } catch (ExecutionException expected) {
      assertThat(expected.getCause()).isInstanceOf(ClosedChannelException.class);
    }
  }
Assert that the future fails, with the failure caused by {@code ClosedChannelException}.
jimfs/src/test/java/com/google/common/jimfs/JimfsAsynchronousFileChannelTest.java