@Test public void testSuccessfulCompletionWithProgress() throws Exception { @SuppressWarnings("unchecked") final ProgressAsyncHandler<Object> handler = mock(ProgressAsyncHandler.class); when(handler.onCompleted()).thenReturn(handler); final InOrder inOrder = inOrder(handler); final Single<?> underTest = AsyncHttpSingle.create(bridge -> { try { assertThat(bridge, is(instanceOf(ProgressAsyncHandler.class))); final ProgressAsyncHandler<?> progressBridge = (ProgressAsyncHandler<?>) bridge; progressBridge.onHeadersWritten(); inOrder.verify(handler).onHeadersWritten(); progressBridge.onContentWriteProgress(60, 40, 100); inOrder.verify(handler).onContentWriteProgress(60, 40, 100); progressBridge.onContentWritten(); inOrder.verify(handler).onContentWritten(); progressBridge.onStatusReceived(null); inOrder.verify(handler).onStatusReceived(null); progressBridge.onHeadersReceived(null); inOrder.verify(handler).onHeadersReceived(null); progressBridge.onBodyPartReceived(null); inOrder.verify(handler).onBodyPartReceived(null); bridge.onTrailingHeadersReceived(null); verify(handler).onTrailingHeadersReceived(null); progressBridge.onCompleted(); inOrder.verify(handler).onCompleted(); } catch (final Throwable t) { bridge.onThrowable(t); } return mock(Future.class); }, () -> handler); final TestSubscriber<Object> subscriber = new TestSubscriber<>(); underTest.subscribe(subscriber); inOrder.verifyNoMoreInteractions(); subscriber.awaitTerminalEvent(); subscriber.assertTerminalEvent(); subscriber.assertNoErrors(); subscriber.assertCompleted(); subscriber.assertValue(handler); }
public static Single<Response> create(BoundRequestBuilder builder) { requireNonNull(builder); return create(builder::execute, AsyncCompletionHandlerBase::new); }
AsyncHttpSingle { public static Single<Response> create(BoundRequestBuilder builder) { requireNonNull(builder); return create(builder::execute, AsyncCompletionHandlerBase::new); } }
AsyncHttpSingle { public static Single<Response> create(BoundRequestBuilder builder) { requireNonNull(builder); return create(builder::execute, AsyncCompletionHandlerBase::new); } private  AsyncHttpSingle(); }
AsyncHttpSingle { public static Single<Response> create(BoundRequestBuilder builder) { requireNonNull(builder); return create(builder::execute, AsyncCompletionHandlerBase::new); } private  AsyncHttpSingle(); static Single<Response> create(BoundRequestBuilder builder); static Single<Response> create(Func1<? super AsyncHandler<?>, ? extends Future<?>> requestTemplate); static Single<T> create(BoundRequestBuilder builder, Func0<? extends AsyncHandler<? extends T>> handlerSupplier); static Single<T> create(Func1<? super AsyncHandler<?>, ? extends Future<?>> requestTemplate,
                                     Func0<? extends AsyncHandler<? extends T>> handlerSupplier); }
AsyncHttpSingle { public static Single<Response> create(BoundRequestBuilder builder) { requireNonNull(builder); return create(builder::execute, AsyncCompletionHandlerBase::new); } private  AsyncHttpSingle(); static Single<Response> create(BoundRequestBuilder builder); static Single<Response> create(Func1<? super AsyncHandler<?>, ? extends Future<?>> requestTemplate); static Single<T> create(BoundRequestBuilder builder, Func0<? extends AsyncHandler<? extends T>> handlerSupplier); static Single<T> create(Func1<? super AsyncHandler<?>, ? extends Future<?>> requestTemplate,
                                     Func0<? extends AsyncHandler<? extends T>> handlerSupplier);  }