@Test
public void nextCancelRace() {

    for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
        final PublishProcessor<Integer> pp = PublishProcessor.create();
        final ConnectableFlowable<Integer> cf = pp.publish();
        final TestSubscriber<Integer> ts = cf.test();
        Runnable r1 = new Runnable() {
            @Override
            public void run() {
                pp.onNext(1);
            }
        };
        Runnable r2 = new Runnable() {
            @Override
            public void run() {
                ts.cancel();
            }
        };
        TestHelper.race(r1, r2);
    }
}