Created
August 20, 2016 13:04
-
-
Save abhirockzz/59237d9e75ecd8bfdc00c49caa892930 to your computer and use it in GitHub Desktop.
What happens when a server side error happens during an aysnc JAX-RS client API call for a Response entity ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void completedMethodCalledAfterServerSideFailureForGenericEntity() throws InterruptedException { | |
CountDownLatch l = new CountDownLatch(1); | |
ClientBuilder.newClient().target("http://google.com").path("first").request().async().get(new InvocationCallback<Response>() { | |
@Override | |
public void completed(Response response) { | |
Logger.getAnonymousLogger().log(Level.INFO, "HTTP Respoonse status: {0}", response.getStatus()); | |
l.countDown(); | |
} | |
@Override | |
public void failed(Throwable throwable) { | |
} | |
}); | |
boolean result = l.await(3, TimeUnit.SECONDS); | |
assertTrue("Completed method not called", result); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment