@Test
public void reentrantOnNextCancel() {

    final PublishProcessor<Integer> pp = PublishProcessor.create();
    TestSubscriber<Integer> ts = new TestSubscriber<Integer>() {
        @Override
        public void onNext(Integer t) {
            if (t == 1) {
                pp.onNext(2);
                cancel();
            }
            super.onNext(t);
        }
    };
    pp.replay().autoConnect().subscribe(ts);
    pp.onNext(1);
    ts.assertValues(1);
}