@Test
public void subscribeOnNextRace() {

    for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
        final PublishProcessor<Integer> pp = PublishProcessor.create();
        final ConnectableFlowable<Integer> cf = pp.replay();
        final TestSubscriber<Integer> ts1 = new TestSubscriber<Integer>();
        Runnable r1 = new Runnable() {
            @Override
            public void run() {
                cf.subscribe(ts1);
            }
        };
        Runnable r2 = new Runnable() {
            @Override
            public void run() {
                for (int j = 0; j < 1000; j++) {
                    pp.onNext(j);
                }
            }
        };
        TestHelper.race(r1, r2);
    }
}