@Test public void usesProgressAsyncHandler() { given(handlerSupplier.get()).willReturn(progressHandler); underTest.prepare(request, handlerSupplier).subscribe(); then(asyncHttpClient).should().executeRequest(eq(request), handlerCaptor.capture()); final AsyncHandler<Object> bridge = handlerCaptor.getValue(); assertThat(bridge, is(instanceOf(ProgressAsyncHandler.class))); }
@Override public <T> Maybe<T> prepare(Request request, Supplier<? extends AsyncHandler<T>> handlerSupplier) { requireNonNull(request); requireNonNull(handlerSupplier); return Maybe.create(emitter -> { final AsyncHandler<?> bridge = createBridge(emitter, handlerSupplier.get()); final Future<?> responseFuture = asyncHttpClient.executeRequest(request, bridge); emitter.setDisposable(Disposables.fromFuture(responseFuture)); }); }
DefaultRxHttpClient implements RxHttpClient { @Override public <T> Maybe<T> prepare(Request request, Supplier<? extends AsyncHandler<T>> handlerSupplier) { requireNonNull(request); requireNonNull(handlerSupplier); return Maybe.create(emitter -> { final AsyncHandler<?> bridge = createBridge(emitter, handlerSupplier.get()); final Future<?> responseFuture = asyncHttpClient.executeRequest(request, bridge); emitter.setDisposable(Disposables.fromFuture(responseFuture)); }); } }
DefaultRxHttpClient implements RxHttpClient { @Override public <T> Maybe<T> prepare(Request request, Supplier<? extends AsyncHandler<T>> handlerSupplier) { requireNonNull(request); requireNonNull(handlerSupplier); return Maybe.create(emitter -> { final AsyncHandler<?> bridge = createBridge(emitter, handlerSupplier.get()); final Future<?> responseFuture = asyncHttpClient.executeRequest(request, bridge); emitter.setDisposable(Disposables.fromFuture(responseFuture)); }); } DefaultRxHttpClient(AsyncHttpClient asyncHttpClient); }
DefaultRxHttpClient implements RxHttpClient { @Override public <T> Maybe<T> prepare(Request request, Supplier<? extends AsyncHandler<T>> handlerSupplier) { requireNonNull(request); requireNonNull(handlerSupplier); return Maybe.create(emitter -> { final AsyncHandler<?> bridge = createBridge(emitter, handlerSupplier.get()); final Future<?> responseFuture = asyncHttpClient.executeRequest(request, bridge); emitter.setDisposable(Disposables.fromFuture(responseFuture)); }); } DefaultRxHttpClient(AsyncHttpClient asyncHttpClient); @Override Maybe<T> prepare(Request request, Supplier<? extends AsyncHandler<T>> handlerSupplier); }
DefaultRxHttpClient implements RxHttpClient { @Override public <T> Maybe<T> prepare(Request request, Supplier<? extends AsyncHandler<T>> handlerSupplier) { requireNonNull(request); requireNonNull(handlerSupplier); return Maybe.create(emitter -> { final AsyncHandler<?> bridge = createBridge(emitter, handlerSupplier.get()); final Future<?> responseFuture = asyncHttpClient.executeRequest(request, bridge); emitter.setDisposable(Disposables.fromFuture(responseFuture)); }); } DefaultRxHttpClient(AsyncHttpClient asyncHttpClient); @Override Maybe<T> prepare(Request request, Supplier<? extends AsyncHandler<T>> handlerSupplier);  }