@Test
public void subscribeRace() {

    for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
        final UnicastProcessor<Integer> us = UnicastProcessor.create();
        final TestSubscriber<Integer> ts1 = new TestSubscriber<Integer>();
        final TestSubscriber<Integer> ts2 = new TestSubscriber<Integer>();
        Runnable r1 = new Runnable() {
            @Override
            public void run() {
                us.subscribe(ts1);
            }
        };
        Runnable r2 = new Runnable() {
            @Override
            public void run() {
                us.subscribe(ts2);
            }
        };
        TestHelper.race(r1, r2);
        if (ts1.errorCount() == 0) {
            ts2.assertFailure(IllegalStateException.class);
        } else
        if (ts2.errorCount() == 0) {
            ts1.assertFailure(IllegalStateException.class);
        } else {
            fail("Neither TestObserver failed");
        }
    }
}