urlConnection.setConnectTimeout(config.getConnectionTimeout());
if (config.getConnectionTimeout() > 0) nettyConfig.addProperty("connectTimeoutMillis", config.getConnectionTimeout()); for (Entry<String, Object> entry : nettyConfig.propertiesSet()) { String key = entry.getKey();
private Connection obtainConnection0(final Request request, final GrizzlyResponseFuture requestFuture) throws IOException, ExecutionException, InterruptedException, TimeoutException { final UriComponents uri = request.getURI(); final ProxyServer proxy = requestFuture.getProxy(); String host = (proxy != null) ? proxy.getHost() : uri.getHost(); int port = (proxy != null) ? proxy.getPort() : uri.getPort(); int cTimeout = provider.clientConfig.getConnectionTimeout(); FutureImpl<Connection> future = Futures.createSafeFuture(); CompletionHandler<Connection> ch = Futures.toCompletionHandler(future, createConnectionCompletionHandler(request, requestFuture, null)); if (cTimeout > 0) { connectionHandler.connect(new InetSocketAddress(host, getPort(uri, port)), ch); return future.get(cTimeout, TimeUnit.MILLISECONDS); } else { connectionHandler.connect(new InetSocketAddress(host, getPort(uri, port)), ch); return future.get(); } }
allowPoolingConnections = prototype.isAllowPoolingConnections(); providerConfig = prototype.getAsyncHttpProviderConfig(); connectionTimeout = prototype.getConnectionTimeout(); pooledConnectionIdleTimeout = prototype.getPooledConnectionIdleTimeout(); readTimeout = prototype.getReadTimeout();