ResourceSubscriber implements FlowableSubscriber<T>, Disposable { @Override public final void onSubscribe(Subscription s) { if (EndConsumerHelper.setOnce(this.s, s, getClass())) { long r = missedRequested.getAndSet(0L); if (r != 0L) { s.request(r); } onStart(); } }  final void add(Disposable resource); @Override final void onSubscribe(Subscription s); @Override final void dispose(); @Override final boolean isDisposed();  }
@Test public void startOnce() { List<Throwable> error = TestHelper.trackPluginErrors(); try { TestResourceSubscriber<Integer> tc = new TestResourceSubscriber<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(); } }