diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java index caadb23c274..c2274ef5eda 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java @@ -15,6 +15,7 @@ package org.eclipse.jetty.client; import java.io.IOException; import java.net.SocketTimeoutException; +import java.net.UnknownHostException; import java.nio.channels.SelectionKey; import java.nio.channels.SocketChannel; import java.nio.channels.UnresolvedAddressException; @@ -110,11 +111,17 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector { channel.connect(address.toSocketAddress()); } - catch (UnresolvedAddressException ex) + catch (UnresolvedAddressException uae) { channel.close(); - throw ex; + throw uae; } + catch ( UnknownHostException uhe ) + { + channel.close(); + throw uhe; + } + _selectorManager.register(channel,destination); ConnectTimeout connectTimeout = new ConnectTimeout(channel,destination); _httpClient.schedule(connectTimeout,_httpClient.getConnectTimeout());