@Test
public void leavingSubscriberOverrequests() {

    final AtomicReference<Flowable<Integer>> ref = new AtomicReference<Flowable<Integer>>();
    PublishProcessor<Integer> pp = PublishProcessor.create();
    pp.publish(new Function<Flowable<Integer>, Publisher<Integer>>() {
        @Override
        public Publisher<Integer> apply(Flowable<Integer> f) throws Exception {
            ref.set(f);
            return Flowable.never();
        }
    }).test();
    TestSubscriber<Integer> ts1 = ref.get().take(2).test();
    pp.onNext(1);
    pp.onNext(2);
    ts1.assertResult(1, 2);
    pp.onNext(3);
    pp.onNext(4);
    TestSubscriber<Integer> ts2 = ref.get().test(0L);
    ts2.assertEmpty();
    ts2.requestMore(2);
    ts2.assertValuesOnly(3, 4);
}