Set the socket read timeout for the underlying HttpClient. A timeout value of 0
specifies an infinite timeout.
@param timeout the timeout value in milliseconds
349269
public void setReadTimeout(int timeout) {
		Assert.isTrue(timeout >= 0, "Timeout must be a non-negative value");
		this.socketTimeout = timeout;
		setLegacySocketTimeout(getHttpClient(), timeout);
	}
1127331
@Override
  public int readTimeout(byte []buf, int offset, int length, long timeout)
    throws IOException
  {
    return read(buf, offset, length);
    /*
    Socket s = _s;
      
    if (s == null) {
      return -1;
    }
    
    int oldTimeout = s.getSoTimeout();
    s.setSoTimeout((int) timeout);
    
    try {
      int result = read(buf, offset, length);
      
      if (result >= 0) {
        return result;
      }
      else if (_is == null || _is.available() < 0) {
        return -1;
      }
      else {
        return ReadBuffer.READ_TIMEOUT;
      }
    } finally {
      s.setSoTimeout(oldTimeout);
    }
    */
  }
311385
public void setTimeout(long timeout, TimeUnit unit) {
        this.timeout = timeout;
        this.unit    = unit;
        c.setTimeout(timeout, unit);
    }
877346
public void setScanTimeout(int timeout) {
        scanTimeout = timeout;
        Log.i(TAG, String.format("New scan timeout set: %d seconds", scanTimeout));
    }
172339
function(server, sock) {
  if (server.requestTimeouts.length === 0) {
    // nothing active
    server.timeoutSet = false;
    return;
  }

  // some requests outstanding, check if any have timed-out
  var now = timestamp();
  var soonestTimeout = server.requestTimeouts[0];

  if (soonestTimeout <= now) {
    // timeout occurred!
    sock.end();
    server.connected = false;
    server._socket = undefined;
    server.timeoutSet = false;
    server.error(new Error('socket timed out waiting on response.'));
  } else {
    // no timeout! Setup next one.
    var deadline = soonestTimeout - now;
    sock.setTimeout(deadline, function() {
      timeoutHandler(server, sock);
    });
  }
}
1248783
protected Socket acceptSocket(int timeout)
    {
        try
        {
            Socket s = null;

            if (_listen != null)
            {
                if (_soTimeOut != timeout)
                {
                    _soTimeOut = timeout;
                    _listen.setSoTimeout(_soTimeOut);
                }

                s = _listen.accept();

                try
                {
                    if (getMaxIdleTimeMs() >= 0) s.setSoTimeout(getMaxIdleTimeMs());
                    if (_lingerTimeSecs >= 0)
                        s.setSoLinger(true, _lingerTimeSecs);
                    else
                        s.setSoLinger(false, 0);
                }
                catch (Exception e)
                {
                    LogSupport.ignore(log, e);
                }
            }
            return s;
        }
        catch (java.net.SocketException e)
        {
            // TODO - this is caught and ignored due strange
            // exception from linux java1.2.v1a
            LogSupport.ignore(log, e);
        }
        catch (InterruptedIOException e)
        {
            LogSupport.ignore(log, e);
        }
        catch (IOException e)
        {
            log.warn(LogSupport.EXCEPTION, e);
        }
        return null;
    }
612247
public static Timeout max(Timeout... timeouts)
	{
		Timeout max = null;

		for (Timeout timeout : timeouts)
		{
			if (timeout != null)
				if (max == null || max.getMilliseconds() < timeout.getMilliseconds())
					max = timeout;
		}

		if (max != null)
			return max;
		else
			throw new IllegalArgumentException("Must specify at least one non-null timeout!");
	}
947805
public void setTimeout(Duration timeout) {

        LettuceAssert.notNull(timeout, "Timeout duration must not be null");
        LettuceAssert.isTrue(!timeout.isNegative(), "Timeout duration must be greater or equal to zero");

        this.timeout = timeout;

        if (channelWriter instanceof CommandExpiryWriter) {
            ((CommandExpiryWriter) channelWriter).setTimeout(timeout);
        }
    }
809474
public static final HttpClient getClient(int timeout) {
        HttpClientBuilder client = HttpClientBuilder.create();
        // set the connection manager
        client.setConnectionManager(connectionManager);
        // dont retry
        client.setRetryHandler(new DefaultHttpRequestRetryHandler(0, false));
        // establish a connection within x seconds
        RequestConfig config = RequestConfig.custom().setSocketTimeout(timeout).build();
        client.setDefaultRequestConfig(config);
        // no redirects
        client.disableRedirectHandling();
        // set custom ua
        client.setUserAgent(userAgent);
        // set the proxy if the user has one set
        if ((System.getProperty("http.proxyHost") != null) && (System.getProperty("http.proxyPort") != null)) {
            HttpHost proxy = new HttpHost(System.getProperty("http.proxyHost").toString(), Integer.valueOf(System.getProperty("http.proxyPort")));
            client.setProxy(proxy);
        }
        return client.build();
    }
1361603
private void setTimeout(HttpURLConnection httpUrlConnection) {
		String connTimeout = Config.getProperty(Config.TIMEOUT_CONNECTION);
		if (StringUtils.hasText(connTimeout)) {
			httpUrlConnection.setReadTimeout(new Integer(connTimeout.trim()));			
		}
		String reqTimeout = Config.getProperty(Config.TIMEOUT_REQUEST);
		if (StringUtils.hasText(reqTimeout)) {
			httpUrlConnection.setConnectTimeout(new Integer(reqTimeout.trim()));			
		}
	}
1009473
def _set_socket_timeout(cls, sock, timeout=None):
    """"""
    if timeout is not None:
      prev_timeout = sock.gettimeout()
    try:
      if timeout is not None:
        sock.settimeout(timeout)
      yield
    except socket.timeout:
      raise cls.ProcessStreamTimeout("socket read timed out with timeout {}".format(timeout))
    finally:
      if timeout is not None:
        sock.settimeout(prev_timeout)
899421
def settimeout(self, timeout):
        
        if timeout is not None:
            timeout = float(timeout)
        self._timeout = timeout
982060
public final Connection connectNow(Duration timeout) {
		Objects.requireNonNull(timeout, "timeout");
		try {
			return Objects.requireNonNull(connect().block(timeout), "aborted");
		}
		catch (IllegalStateException e) {
			if (e.getMessage().contains("blocking read")) {
				throw new IllegalStateException("TcpClient couldn't be started within "
						+ timeout.toMillis() + "ms");
			}
			throw e;
		}
	}
771762
@Value("${http.timeout}")
    @SuppressWarnings("static-method")
    public void setDefaultHttpTimeout(int httpTimeout) {
        HttpUtil.defaultHttpTimeout = httpTimeout;
        HttpUtil.httpTimeout = httpTimeout;
    }
1161370
public RestTemplateBuilder setReadTimeout(Duration readTimeout) {
		return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
				this.messageConverters, this.requestFactorySupplier,
				this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
				this.restTemplateCustomizers,
				this.requestFactoryCustomizer.readTimeout(readTimeout),
				this.interceptors);
	}
263192
private static void prepareConnection(URLConnection connection, int timeout, SSLSocketFactory sslFactory) {
        if (timeout == 0) {
            throw new IllegalArgumentException("Zero (infinite) timeouts not permitted");
        }
        connection.setConnectTimeout(timeout);
        connection.setReadTimeout(timeout);
        connection.setDoInput(true); // whether we want to read from the connection
        connection.setDoOutput(false); // whether we want to write to the connection

        if(connection instanceof HttpsURLConnection && sslFactory != null) {
            ((HttpsURLConnection)connection).setSSLSocketFactory(sslFactory);
        }
    }
259671
@Override
  public int readTimeout(byte []buf, int offset, int length, long timeout)
    throws IOException
  {
    Socket s = _s;
      
    if (s == null) {
      return -1;
    }
    
    int oldTimeout = s.getSoTimeout();
    s.setSoTimeout((int) timeout);
    
    try {
      int result = read(buf, offset, length);
      
      if (result >= 0) {
        return result;
      }
      else if (_is == null || _is.available() < 0) {
        return -1;
      }
      else {
        return ReadStream.READ_TIMEOUT;
      }
    } finally {
      s.setSoTimeout(oldTimeout);
    }
  }