@Override
    public void onResponse(Call call, okhttp3.Response okHttpResponse) {
        try {

            final Response response = OkHttpHttpClient.convertResponse(okHttpResponse);
            try {
                @SuppressWarnings("unchecked")
                final T t = converter == null ? (T) response : converter.convert(response);
                okHttpFuture.setResult(t);
                if (callback != null) {
                    callback.onCompleted(t);
                }
            } catch (IOException | RuntimeException e) {
                okHttpFuture.setException(e);
                if (callback != null) {
                    callback.onThrowable(e);
                }
            }
        } finally {
            okHttpFuture.finish();
        }
    }
@Test
    public void shouldReportOAuthException() {
        handler = new OAuthAsyncCompletionHandler<>(callback, OAUTH_EXCEPTION_RESPONSE_CONVERTER, future);
        call.enqueue(handler);

        final Request request = new Request.Builder().url("http://localhost/").build();
        final okhttp3.Response response = new okhttp3.Response.Builder()
                .request(request)
                .protocol(Protocol.HTTP_1_1)
                .code(200)
                .message("ok")
                .body(ResponseBody.create(new byte[0], MediaType.get("text/plain")))
                .build();
        handler.onResponse(call, response);
        assertNull(callback.getResponse());
        assertNotNull(callback.getThrowable());
        assertTrue(callback.getThrowable() instanceof OAuthException);
        // verify latch is released
        assertThrows(ExecutionException.class, new ThrowingRunnable() {
            @Override
            public void run() throws Throwable {
                future.get();
            }
        });
    }