QueueDrainHelper { static boolean isCancelled(BooleanSupplier cancelled) { try { return cancelled.getAsBoolean(); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); return true; } } private  QueueDrainHelper(); static void drainMaxLoop(SimplePlainQueue<T> q, Subscriber<? super U> a, boolean delayError,
            Disposable dispose, QueueDrain<T, U> qd); static boolean checkTerminated(boolean d, boolean empty,
            Subscriber<?> s, boolean delayError, SimpleQueue<?> q, QueueDrain<T, U> qd); static void drainLoop(SimplePlainQueue<T> q, Observer<? super U> a, boolean delayError, Disposable dispose, ObservableQueueDrain<T, U> qd); static boolean checkTerminated(boolean d, boolean empty,
            Observer<?> s, boolean delayError, SimpleQueue<?> q, Disposable disposable, ObservableQueueDrain<T, U> qd); static SimpleQueue<T> createQueue(int capacityHint); static void request(Subscription s, int prefetch); static boolean postCompleteRequest(long n,
                                                  Subscriber<? super T> actual,
                                                  Queue<T> queue,
                                                  AtomicLong state,
                                                  BooleanSupplier isCancelled); static void postComplete(Subscriber<? super T> actual,
                                        Queue<T> queue,
                                        AtomicLong state,
                                        BooleanSupplier isCancelled);  }
@Test public void isCancelled() { assertTrue(QueueDrainHelper.isCancelled(new BooleanSupplier() { @Override public boolean getAsBoolean() throws Exception { throw new IOException(); } })); }