LambdaSubscriber extends AtomicReference<Subscription> implements FlowableSubscriber<T>, Subscription, Disposable, LambdaConsumerIntrospection { @Override public boolean isDisposed() { return get() == SubscriptionHelper.CANCELLED; } LambdaSubscriber(Consumer<? super T> onNext, Consumer<? super Throwable> onError,
            Action onComplete,
            Consumer<? super Subscription> onSubscribe); @Override void onSubscribe(Subscription s); @Override void onNext(T t); @Override void onError(Throwable t); @Override void onComplete(); @Override void dispose(); @Override boolean isDisposed(); @Override void request(long n); @Override void cancel(); @Override boolean hasCustomOnError();  }
@Test public void onSubscribeThrows() { final List<Object> received = new ArrayList<Object>(); LambdaSubscriber<Object> o = new LambdaSubscriber<Object>(new Consumer<Object>() { @Override public void accept(Object v) throws Exception { received.add(v); } }, new Consumer<Throwable>() { @Override public void accept(Throwable e) throws Exception { received.add(e); } }, new Action() { @Override public void run() throws Exception { received.add(100); } }, new Consumer<Subscription>() { @Override public void accept(Subscription s) throws Exception { throw new TestException(); } }); assertFalse(o.isDisposed()); Flowable.just(1).subscribe(o); assertTrue(received.toString(), received.get(0) instanceof TestException); assertEquals(received.toString(), 1, received.size()); assertTrue(o.isDisposed()); }