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 c5982b4a344..5868eebfb9d 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)); + } + } }