public void exampleOnRequestManual() {
    ControlledPullSubscriber<Integer> puller =
        new ControlledPullSubscriber<Integer>(System.out::println);

    Observable.range(0, 3).doOnRequest(i -> System.out.println("Requested " + i)).subscribe(puller);

    puller.requestMore(2);
    puller.requestMore(1);

    // Requested 0
    // Requested 2
    // 0
    // 1
    // Requested 1
    // 2
  }
  @Test
  public void testOnRequestManual() {
    List<Integer> received = new ArrayList<Integer>();
    List<Long> requests = new ArrayList<Long>();

    ControlledPullSubscriber<Integer> puller = new ControlledPullSubscriber<Integer>(received::add);

    Observable.range(0, 3).doOnRequest(requests::add).subscribe(puller);

    assertEquals(Arrays.asList(0L), requests);
    assertEquals(Arrays.asList(), received);
    puller.requestMore(2);
    assertEquals(Arrays.asList(0L, 2L), requests);
    assertEquals(Arrays.asList(0, 1), received);
    puller.requestMore(1);
    assertEquals(Arrays.asList(0L, 2L, 1L), requests);
    assertEquals(Arrays.asList(0, 1, 2), received);
  }