### Question:
JaxrsClientCallback extends ClientCallback { @Override public void handleException(Map<String, Object> ctx, final Throwable ex) { context = ctx; if (handler != null) { handler.failed(ex); } delegate.completeExceptionally(ex); 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 testHandleExceptionCallback() throws Exception { final CyclicBarrier barrier = new CyclicBarrier(1); schedule(barrier, () -> callback.handleException(ctx, new RuntimeException())); assertThrows(ExecutionException.class, () -> future.get()); assertThrows(ExecutionException.class, () -> future.get(10, TimeUnit.MILLISECONDS)); assertThat(future.isCancelled(), equalTo(false)); assertThat(future.isDone(), equalTo(true)); assertThat(state.get(), instanceOf(RuntimeException.class)); }
@Test public void testGetResponseContextOnExceptionCallback() throws Exception { final CyclicBarrier barrier = new CyclicBarrier(1); schedule(barrier, () -> callback.handleException(ctx, new RuntimeException())); assertThat(future.getContext(), nullValue()); assertThat(future.isCancelled(), equalTo(false)); assertThat(future.isDone(), equalTo(true)); }