@Test
public void testAsync() {

    Flowable<Integer> source = Flowable.range(1, 10000);
    for (int i = 0; i < 100; i++) {
        TestSubscriber<Integer> ts1 = new TestSubscriber<Integer>();
        Flowable<Integer> cached = source.replay().autoConnect();
        cached.observeOn(Schedulers.computation()).subscribe(ts1);
        ts1.awaitTerminalEvent(2, TimeUnit.SECONDS);
        ts1.assertNoErrors();
        ts1.assertTerminated();
        assertEquals(10000, ts1.values().size());
        TestSubscriber<Integer> ts2 = new TestSubscriber<Integer>();
        cached.observeOn(Schedulers.computation()).subscribe(ts2);
        ts2.awaitTerminalEvent(2, TimeUnit.SECONDS);
        ts2.assertNoErrors();
        ts2.assertTerminated();
        assertEquals(10000, ts2.values().size());
    }
}