AsyncProcessor extends FlowableProcessor<T> { @CheckReturnValue @NonNull public static <T> AsyncProcessor<T> create() { return new AsyncProcessor<T>(); } @SuppressWarnings("unchecked")  AsyncProcessor(); @CheckReturnValue @NonNull static AsyncProcessor<T> create(); @Override void onSubscribe(Subscription s); @Override void onNext(T t); @SuppressWarnings("unchecked") @Override void onError(Throwable t); @SuppressWarnings("unchecked") @Override void onComplete(); @Override boolean hasSubscribers(); @Override boolean hasThrowable(); @Override boolean hasComplete(); @Override @Nullable Throwable getThrowable(); boolean hasValue(); @Nullable T getValue(); Object[] getValues(); T[] getValues(T[] array);  }
@Test public void cancelRace() { AsyncProcessor<Object> p = AsyncProcessor.create(); for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { final TestSubscriber<Object> ts1 = p.test(); final TestSubscriber<Object> ts2 = p.test(); Runnable r1 = new Runnable() { @Override public void run() { ts1.cancel(); } }; Runnable r2 = new Runnable() { @Override public void run() { ts2.cancel(); } }; TestHelper.race(r1, r2); } }