diff options
author | Simone Bordet | 2013-01-28 22:20:38 +0000 |
---|---|---|
committer | Simone Bordet | 2013-01-28 22:45:44 +0000 |
commit | 40621f0300934703db56cd14196e36c5e185f7c3 (patch) | |
tree | e30a01620c9a1a2c372e37828966adde04c34eeb /jetty-client/src/test/java/org/eclipse/jetty/client/ExternalSiteTest.java | |
parent | 9ba1069383f4f3cef148adb85168ea7c4b3eae8e (diff) | |
download | org.eclipse.jetty.project-40621f0300934703db56cd14196e36c5e185f7c3.tar.gz org.eclipse.jetty.project-40621f0300934703db56cd14196e36c5e185f7c3.tar.xz org.eclipse.jetty.project-40621f0300934703db56cd14196e36c5e185f7c3.zip |
Added test that connects to an external website that exposes a non-HTTP protocol such as SSH.
Diffstat (limited to 'jetty-client/src/test/java/org/eclipse/jetty/client/ExternalSiteTest.java')
-rw-r--r-- | jetty-client/src/test/java/org/eclipse/jetty/client/ExternalSiteTest.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/ExternalSiteTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/ExternalSiteTest.java index c5982b4a34..5868eebfb9 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/ExternalSiteTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/ExternalSiteTest.java @@ -98,4 +98,52 @@ public class ExternalSiteTest }); Assert.assertTrue(latch2.await(10, TimeUnit.SECONDS)); } + + + @Test + public void testExternalSiteWrongProtocol() throws Exception + { + String host = "github.com"; + int port = 22; // SSH port + + // Verify that we have connectivity + try + { + new Socket(host, port); + } + catch (IOException x) + { + Assume.assumeNoException(x); + } + + for (int i = 0; i < 2; ++i) + { + final CountDownLatch latch = new CountDownLatch(3); + client.newRequest(host, port) + .onResponseFailure(new Response.FailureListener() + { + @Override + public void onFailure(Response response, Throwable failure) + { + latch.countDown(); + } + }) + .send(new Response.Listener.Empty() + { + @Override + public void onFailure(Response response, Throwable failure) + { + latch.countDown(); + } + + @Override + public void onComplete(Result result) + { + Assert.assertTrue(result.isFailed()); + latch.countDown(); + } + }); + Assert.assertTrue(latch.await(10, TimeUnit.SECONDS)); + } + } } |