DisposableSubscriber implements FlowableSubscriber<T>, Disposable { @Override public final void onSubscribe(Subscription s) { if (EndConsumerHelper.setOnce(this.s, s, getClass())) { onStart(); } }  @Override final void onSubscribe(Subscription s); @Override final boolean isDisposed(); @Override final void dispose();  }
@Test public void startOnce() { List<Throwable> error = TestHelper.trackPluginErrors(); try { TestDisposableSubscriber<Integer> tc = new TestDisposableSubscriber<Integer>(); tc.onSubscribe(new BooleanSubscription()); BooleanSubscription d = new BooleanSubscription(); tc.onSubscribe(d); assertTrue(d.isCancelled()); assertEquals(1, tc.start); TestHelper.assertError(error, 0, IllegalStateException.class, EndConsumerHelper.composeMessage(tc.getClass().getName())); } finally { RxJavaPlugins.reset(); } }