@Test
public void deferredRequest() {

    final List<Object> list = new ArrayList<Object>();
    Subscriber<Object> sub = new Subscriber<Object>() {
        @Override
        public void onSubscribe(Subscription s) {
            s.request(5);
            list.add(0);
        }
        @Override
        public void onNext(Object t) {
            list.add(t);
        }
        @Override
        public void onError(Throwable t) {
            list.add(t);
        }
        @Override
        public void onComplete() {
            list.add("Done");
        }
    };
    Flowable.range(1, 5).subscribe(sub);
    assertEquals(Arrays.<Object>asList(0, 1, 2, 3, 4, 5, "Done"), list);
}