public void testRecoveredHandledDroppedOffer(){
  AtomicInteger calls=new AtomicInteger();
  SubmissionPublisher<Integer> p=new SubmissionPublisher<Integer>(basicExecutor,4);
  TestSubscriber s1=new TestSubscriber();
  s1.request=false;
  TestSubscriber s2=new TestSubscriber();
  s2.request=false;
  p.subscribe(s1);
  p.subscribe(s2);
  s2.awaitSubscribe();
  s1.awaitSubscribe();
  int n=0;
  for (int i=1; i <= 8; ++i) {
    int d=p.offer(i,null);
    n=n + 2 + (d < 0 ? d : 0);
  }
  p.close();
  s2.awaitComplete();
  s1.awaitComplete();
  assertEquals(n,s1.nexts + s2.nexts);
  assertTrue(calls.get() >= 2);
}

public void testRecoveredHandledDroppedOffer ( ) { AtomicInteger calls = new AtomicInteger ( ) ; SubmissionPublisher < Integer > p = new SubmissionPublisher < Integer > ( basicExecutor , 4 ) ; TestSubscriber s1 = new TestSubscriber ( ) ; s1 . request = false ; TestSubscriber s2 = new TestSubscriber ( ) ; s2 . request = false ; p . subscribe ( s1 ) ; p . subscribe ( s2 ) ; s2 . awaitSubscribe ( ) ; s1 . awaitSubscribe ( ) ; int n = 0 ; for ( int i = 1 ; i <= 8 ; ++ i ) { int d = p . offer ( i , null ) ; n = n + 2 + ( d < 0 ? d : 0 ) ; } p . close ( ) ; s2 . awaitComplete ( ) ; s1 . awaitComplete ( ) ; assertEquals ( n , s1 . nexts + s2 . nexts ) ; assertTrue ( calls . get ( ) >= 2 ) ; }
offer succeeds if drop handler forces request
