SerializedSubscriber implements FlowableSubscriber<T>, Subscription { @Override public void onSubscribe(Subscription s) { if (SubscriptionHelper.validate(this.subscription, s)) { this.subscription = s; actual.onSubscribe(this); } } SerializedSubscriber(Subscriber<? super T> actual);  SerializedSubscriber(Subscriber<? super T> actual, boolean delayError); @Override void onSubscribe(Subscription s); @Override void onNext(T t); @Override void onError(Throwable t); @Override void onComplete(); @Override void request(long n); @Override void cancel();  }
@Test public void startOnce() { List<Throwable> error = TestHelper.trackPluginErrors(); try { TestSubscriber<Integer> ts = new TestSubscriber<Integer>(); final SerializedSubscriber<Integer> so = new SerializedSubscriber<Integer>(ts); so.onSubscribe(new BooleanSubscription()); BooleanSubscription d = new BooleanSubscription(); so.onSubscribe(d); assertTrue(d.isCancelled()); TestHelper.assertError(error, 0, IllegalStateException.class, "Subscription already set!"); } finally { RxJavaPlugins.reset(); } }