FlowableReplay extends ConnectableFlowable<T> implements HasUpstreamPublisher<T>, Disposable { @Override public void dispose() { current.lazySet(null); } private  FlowableReplay(Publisher<T> onSubscribe, Flowable<T> source,
            final AtomicReference<ReplaySubscriber<T>> current,
            final Callable<? extends ReplayBuffer<T>> bufferFactory); static Flowable<R> multicastSelector(
            final Callable<? extends ConnectableFlowable<U>> connectableFactory,
            final Function<? super Flowable<U>, ? extends Publisher<R>> selector); static ConnectableFlowable<T> observeOn(final ConnectableFlowable<T> cf, final Scheduler scheduler); @SuppressWarnings("unchecked") static ConnectableFlowable<T> createFrom(Flowable<? extends T> source); static ConnectableFlowable<T> create(Flowable<T> source,
            final int bufferSize); static ConnectableFlowable<T> create(Flowable<T> source,
            long maxAge, TimeUnit unit, Scheduler scheduler); static ConnectableFlowable<T> create(Flowable<T> source,
            final long maxAge, final TimeUnit unit, final Scheduler scheduler, final int bufferSize); @Override Publisher<T> source(); @Override void dispose(); @Override boolean isDisposed(); @Override void connect(Consumer<? super Disposable> connection);  }
@Test public void testColdReplayBackpressure() { Flowable<Integer> source = Flowable.range(0, 1000).replay().autoConnect(); TestSubscriber<Integer> ts = new TestSubscriber<Integer>(0L); ts.request(10); source.subscribe(ts); ts.assertNoErrors(); ts.assertNotComplete(); List<Integer> onNextEvents = ts.values(); assertEquals(10, onNextEvents.size()); for (int i = 0; i < 10; i++) { assertEquals((Integer)i, onNextEvents.get(i)); } ts.dispose(); }