@Override public void subscribe(SingleEmitter<Integer> e) throws Exception { e.setDisposable(d); e.onError(new TestException()); e.onSuccess(2); e.onError(new TestException()); } })
@Override public void subscribe(SingleEmitter<Integer> e) throws Exception { e.setDisposable(d); e.onSuccess(1); e.onError(new TestException()); e.onSuccess(2); e.onError(new TestException()); } })
@Override public void subscribe(SingleEmitter<Integer> e) throws Exception { e.setDisposable(d1); e.setCancellable(new Cancellable() { @Override public void cancel() throws Exception { d2.dispose(); } }); e.onSuccess(1); e.onError(new TestException()); e.onSuccess(2); e.onError(new TestException()); } })
.subscribeWith(disposableSingleObserverFromEmitter(emitter)); emitter.setDisposable(disposableGattObserver); connectionStateChangedAction.onConnectionStateChange(CONNECTING);
private Single<HttpResponse> sendRequestInternalAsync(final HttpRequest request, final HttpClientConfiguration configuration) { addHeaders(request); // Creates cold observable from an emitter return Single.create((SingleEmitter<HttpResponse> responseEmitter) -> { AcquisitionListener listener = new AcquisitionListener(channelPool, request, responseEmitter); responseEmitter.setDisposable(listener); channelPool.acquire(request.url().toURI(), configuration.proxy()).addListener(listener); }); } }