Created
October 26, 2010 16:45
-
-
Save jfarcand/647267 to your computer and use it in GitHub Desktop.
This file contains hidden or 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(groups = {"standalone", "async"}) | |
public void asyncConnectInvalidHostFuture() throws Throwable { | |
AsyncHttpClient c = new AsyncHttpClient(); | |
try { | |
Response response = c.preparePost("http://aninvalidhost:9999/").execute(new AsyncCompletionHandlerAdapter() { | |
/* @Override */ | |
public void onThrowable(Throwable t) { | |
t.printStackTrace(); | |
} | |
}).get(); | |
assertNull(response, "Should have thrown ExecutionException"); | |
} catch (ExecutionException ex) { | |
Throwable cause = ex.getCause(); | |
if (!(cause instanceof ConnectException)) { | |
fail("Should have been caused by ConnectException, not by " + cause.getClass().getName()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@test(groups = {"standalone", "async"})
public void asyncConnectInvalidHostFuture() throws Throwable {