use of io.reactivex.functions.LongConsumer in project RxJava by ReactiveX.
the class FlowableSkipTest method testBackpressureMultipleSmallAsyncRequests.
@Test
public void testBackpressureMultipleSmallAsyncRequests() throws InterruptedException {
final AtomicLong requests = new AtomicLong(0);
TestSubscriber<Long> ts = new TestSubscriber<Long>(0L);
Flowable.interval(100, TimeUnit.MILLISECONDS).doOnRequest(new LongConsumer() {
@Override
public void accept(long n) {
requests.addAndGet(n);
}
}).skip(4).subscribe(ts);
Thread.sleep(100);
ts.request(1);
ts.request(1);
Thread.sleep(100);
ts.dispose();
// FIXME not assertable anymore
// ts.assertUnsubscribed();
ts.assertNoErrors();
assertEquals(6, requests.get());
}
Aggregations