@Test
public void onSuccessCancelRace() {

    for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
        final PublishSubject<Integer> ps = PublishSubject.create();
        final Future<?> f = ps.single(-99).toFuture();
        ps.onNext(1);
        Runnable r1 = new Runnable() {
            @Override
            public void run() {
                f.cancel(true);
            }
        };
        Runnable r2 = new Runnable() {
            @Override
            public void run() {
                ps.onComplete();
            }
        };
        TestHelper.race(r1, r2);
    }
}