@Test
public void cancel() throws Exception {

    assertFalse(fs.isDone());
    assertFalse(fs.isCancelled());
    fs.cancel();
    fs.cancel();
    fs.request(10);
    fs.request(-99);
    fs.cancel(false);
    assertTrue(fs.isDone());
    assertTrue(fs.isCancelled());
    try {
        fs.get();
        fail("Should have thrown");
    } catch (CancellationException ex) {
        // expected
    }
    try {
        fs.get(1, TimeUnit.MILLISECONDS);
        fail("Should have thrown");
    } catch (CancellationException ex) {
        // expected
    }
}