@Test public void testCancelBeforeTerminal() { toSource(publisher).subscribe(subscriber); subscriber.request(3); fireChannelRead(1); assertThat(subscriber.takeItems(), contains(1)); subscriber.cancel(); assertThat("Channel not closed post cancel.", channel.closeFuture().isDone(), is(true)); }
private void cancel(SubscriptionImpl forSubscription) { if (forSubscription != subscription) { return; } resetSubscription(); pending = null; if (fatalError == null) { fatalError = StacklessClosedChannelException.newInstance(NettyChannelPublisher.class, "cancel"); } closeChannelInbound(); }
NettyChannelPublisher extends SubscribablePublisher<T> { private void cancel(SubscriptionImpl forSubscription) { if (forSubscription != subscription) { return; } resetSubscription(); pending = null; if (fatalError == null) { fatalError = StacklessClosedChannelException.newInstance(NettyChannelPublisher.class, "cancel"); } closeChannelInbound(); } }
NettyChannelPublisher extends SubscribablePublisher<T> { private void cancel(SubscriptionImpl forSubscription) { if (forSubscription != subscription) { return; } resetSubscription(); pending = null; if (fatalError == null) { fatalError = StacklessClosedChannelException.newInstance(NettyChannelPublisher.class, "cancel"); } closeChannelInbound(); } NettyChannelPublisher(Channel channel, Predicate<T> terminalSignalPredicate, CloseHandler closeHandler); }
NettyChannelPublisher extends SubscribablePublisher<T> { private void cancel(SubscriptionImpl forSubscription) { if (forSubscription != subscription) { return; } resetSubscription(); pending = null; if (fatalError == null) { fatalError = StacklessClosedChannelException.newInstance(NettyChannelPublisher.class, "cancel"); } closeChannelInbound(); } NettyChannelPublisher(Channel channel, Predicate<T> terminalSignalPredicate, CloseHandler closeHandler);  }
NettyChannelPublisher extends SubscribablePublisher<T> { private void cancel(SubscriptionImpl forSubscription) { if (forSubscription != subscription) { return; } resetSubscription(); pending = null; if (fatalError == null) { fatalError = StacklessClosedChannelException.newInstance(NettyChannelPublisher.class, "cancel"); } closeChannelInbound(); } NettyChannelPublisher(Channel channel, Predicate<T> terminalSignalPredicate, CloseHandler closeHandler);   }