SubscriptionProxy { @SuppressWarnings("unused") Disposable subscribe(Observer<? super T> observer) { dispose(); disposable = proxy.subscribeWith(disposableWrapper(observer)); disposableList.add(disposable); return disposable; } private  SubscriptionProxy(Observable<T> sourceObservable, Action onTerminate);   }
@Test public void testSubscribe() { TestObserver<Integer> observer = new TestObserver<>(); Observable<Integer> observable = Observable.create(new ObservableOnSubscribe<Integer>() { @Override public void subscribe(@NonNull ObservableEmitter<Integer> emitter) throws Exception { emitter.onNext(1234); emitter.onComplete(); } }); SubscriptionProxy<Integer> proxy = SubscriptionProxy.create(observable); proxy.subscribe(observer); observer.assertComplete(); observer.assertValue(1234); }