Subscriber implements Observer<T>, Subscription { public void setProducer(Producer producer) { long toRequest; boolean setProducer = false; synchronized (this) { toRequest = requested; p = producer; if (op != null) { if (toRequest == Long.MIN_VALUE) { setProducer = true; } } } if (setProducer) { op.setProducer(p); } else { if (toRequest == Long.MIN_VALUE) { p.request(Long.MAX_VALUE); } else { p.request(toRequest); } } } protected  Subscriber(); protected  Subscriber(Subscriber<?> op); protected  Subscriber(Subscriber<?> op, boolean shareSubscriptions); final void add(Subscription s); @Override final void unsubscribe(); @Override final boolean isUnsubscribed(); void onStart(); void setProducer(Producer producer);  }
@Test public void testRequestFromFinalSubscribeWithoutRequestValue() { Subscriber<String> s = new TestSubscriber<String>(); final AtomicLong r = new AtomicLong(); s.setProducer(new Producer() { @Override public void request(long n) { r.set(n); } }); assertEquals(Long.MAX_VALUE, r.get()); }