From 94137583f8289b7c87c1509b2abf19c0aebce3d0 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Mon, 26 Sep 2016 15:04:21 +0200 Subject: [PATCH] Added assumption to make test more robust. --- .../org/eclipse/jetty/client/HttpClientTest.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTest.java index e5240b44c51..2320b81256e 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTest.java @@ -810,10 +810,23 @@ public class HttpClientTest extends AbstractHttpClientServerTest @Test public void testConnectThrowsUnknownHostException() throws Exception { + String host = "idontexist"; + int port = 80; + + try + { + Socket socket = new Socket(); + socket.connect(new InetSocketAddress(host, port), 1000); + Assume.assumeTrue("Host must not be resolvable", false); + } + catch (IOException ignored) + { + } + start(new EmptyServerHandler()); final CountDownLatch latch = new CountDownLatch(1); - client.newRequest("idontexist", 80) + client.newRequest(host, port) .send(result -> { Assert.assertTrue(result.isFailed());