### Question:
JaxrsClientCallback extends ClientCallback { @SuppressWarnings("unchecked") public void handleResponse(Map<String, Object> ctx, Object[] res) { context = ctx; if (handler != null) { handler.completed((T)res[0]); } delegate.complete(res); synchronized (this) { notifyAll(); } } JaxrsClientCallback(final InvocationCallback<T> handler,
                        Class<?> responseClass,
                        Type outGenericType); InvocationCallback<T> getHandler(); Type getOutGenericType(); Class<?> getResponseClass(); @Override boolean cancel(boolean mayInterruptIfRunning); Future<T> createFuture(); @SuppressWarnings("unchecked") void handleResponse(Map<String, Object> ctx, Object[] res); @Override void handleException(Map<String, Object> ctx, final Throwable ex);  }### Answer:
@Test public void testHandleResponseCallback() throws Exception { final CyclicBarrier barrier = new CyclicBarrier(2); Object[] result = new String[] {"results"}; schedule(barrier, () -> callback.handleResponse(ctx, result)); barrier.await(5, TimeUnit.SECONDS); assertThat(future.get(), equalTo("results")); assertThat(future.get(10, TimeUnit.MILLISECONDS), equalTo("results")); assertThat(future.isCancelled(), equalTo(false)); assertThat(future.isDone(), equalTo(true)); assertThat(state.get(), equalTo("results")); }
@Test public void testGetResponseContextOnSuccessCallback() throws Exception { final CyclicBarrier barrier = new CyclicBarrier(2); Object[] result = new String[] {"results"}; schedule(barrier, () -> callback.handleResponse(ctx, result)); barrier.await(5, TimeUnit.SECONDS); assertThat(future.getContext(), equalTo(ctx)); assertThat(future.get(), equalTo("results")); assertThat(future.get(10, TimeUnit.MILLISECONDS), equalTo("results")); assertThat(future.isCancelled(), equalTo(false)); assertThat(future.isDone(), equalTo(true)); assertThat(state.get(), equalTo("results")); }