@Test
public void subscribeCancelRace() {

    for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
        final TestObserver<Integer> to = new TestObserver<Integer>();
        final ReplaySubject<Integer> rp = ReplaySubject.create();
        Runnable r1 = new Runnable() {
            @Override
            public void run() {
                rp.subscribe(to);
            }
        };
        Runnable r2 = new Runnable() {
            @Override
            public void run() {
                to.cancel();
            }
        };
        TestHelper.race(r1, r2);
    }
}