SingleSubject extends Single<T> implements SingleObserver<T> { @CheckReturnValue @NonNull public static <T> SingleSubject<T> create() { return new SingleSubject<T>(); } @SuppressWarnings("unchecked")  SingleSubject(); @CheckReturnValue @NonNull static SingleSubject<T> create(); @Override void onSubscribe(@NonNull Disposable d); @SuppressWarnings("unchecked") @Override void onSuccess(@NonNull T value); @SuppressWarnings("unchecked") @Override void onError(@NonNull Throwable e); @Nullable T getValue(); boolean hasValue(); @Nullable Throwable getThrowable(); boolean hasThrowable(); boolean hasObservers();  }
@Test public void addRemoveRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { final SingleSubject<Integer> ss = SingleSubject.create(); final TestObserver<Integer> to = ss.test(); Runnable r1 = new Runnable() { @Override public void run() { ss.test(); } }; Runnable r2 = new Runnable() { @Override public void run() { to.cancel(); } }; TestHelper.race(r1, r2); } }