@Test
  public void testCancelBeforeSet() {
    AsyncSubscription as = new AsyncSubscription();

    Subscription s = mock(Subscription.class);

    as.request(1);
    as.cancel();

    assertFalse(as.setSubscription(s));

    verify(s, never()).request(1);
    verify(s).cancel();
  }
  @Test
  public void testNoResource() {
    AsyncSubscription as = new AsyncSubscription();

    Subscription s = mock(Subscription.class);

    assertTrue(as.setSubscription(s));

    as.request(1);

    as.cancel();

    verify(s).request(1);
    verify(s).cancel();
  }