### Question:
JaxwsClientCallback extends ClientCallback { @Override public void handleException(Map<String, Object> ctx, final Throwable ex) { context = ctx; if (handler != null) { handler.handleResponse(new Response<T>() { protected boolean cancelled; public Map<String, Object> getContext() { return context; } public boolean cancel(boolean mayInterruptIfRunning) { cancelled = true; return true; } public T get() throws InterruptedException, ExecutionException { throw new ExecutionException(ex); } public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { throw new ExecutionException(ex); } public boolean isCancelled() { return cancelled; } public boolean isDone() { return true; } }); } delegate.completeExceptionally(mapThrowable(ex)); synchronized (this) { notifyAll(); } } JaxwsClientCallback(final AsyncHandler<T> handler, Object p); 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, () -> callback.get()); assertThrows(ExecutionException.class, () -> callback.get(10, TimeUnit.MILLISECONDS)); assertThat(callback.isCancelled(), equalTo(false)); assertThat(callback.isDone(), equalTo(true)); }
@Test public void testGetResponseContextOnExceptionCallback() throws Exception { final CyclicBarrier barrier = new CyclicBarrier(1); schedule(barrier, () -> callback.handleException(ctx, new RuntimeException())); assertThrows(ExecutionException.class, () -> callback.getResponseContext()); assertThat(callback.isCancelled(), equalTo(false)); assertThat(callback.isDone(), equalTo(true)); }