Set the connection timeout for the underlying HttpClient.
A timeout value of 0 specifies an infinite timeout.
@param timeout the timeout value in milliseconds
@see org.apache.commons.httpclient.params.HttpConnectionManagerParams#setConnectionTimeout(int)
978816
public void setConnectTimeout(int timeout) {
        Assert.isTrue(timeout >= 0, "Timeout must be a non-negative value");
        this.httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(timeout);
    }
625093
public CliCommandBuilder setTimeout(final int timeout) {
        if (timeout > 0) {
            addCliArgument(CliArgument.TIMEOUT, Integer.toString(timeout));
        } else {
            addCliArgument(CliArgument.TIMEOUT, null);
        }
        return this;
    }
874187
private void setConnectTimeout(HttpURLConnection connection) {
        try {
            Map<String, String> endpointProperties = this.api.getEndpointProperties();
            if (endpointProperties.containsKey("timeouts.connect")) { //$NON-NLS-1$
                int connectTimeoutMs = new Integer(endpointProperties.get("timeouts.connect")); //$NON-NLS-1$
                connection.setConnectTimeout(connectTimeoutMs);
            }
        } catch (Throwable t) {
        }
    }
1204729
@Nonnull
  public EChange setConnectionTimeoutMilliSecs (final long nMilliSecs)
  {
    if (m_nConnectionTimeoutMilliSecs == nMilliSecs)
      return EChange.UNCHANGED;
    m_nConnectionTimeoutMilliSecs = nMilliSecs;
    return EChange.CHANGED;
  }
1246572
public void setSessionTimeout(Long timeout, TimeUnit unit) {
        long t = unit.toMillis(timeout);
        properties.put("request.timeout.ms", String.valueOf(t + 60000));
        properties.put("session.timeout.ms", String.valueOf(t));
    }
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);
    }
    */
  }
988013
public ConverterServerBuilder requestTimeout(long timeout, TimeUnit unit) {
        assertNumericArgument(timeout, true);
        this.requestTimeout = unit.toMillis(timeout);
        return this;
    }
1005977
public void setTimeout(int milliseconds)
  {
    if(ctx != null)
    {
      QueryDao dao = (QueryDao) ctx.getBean("queryDao");
      if(dao != null)
      {
        dao.setTimeout(milliseconds);
      }
    }
  }
877346
public void setScanTimeout(int timeout) {
        scanTimeout = timeout;
        Log.i(TAG, String.format("New scan timeout set: %d seconds", scanTimeout));
    }
1225330
protected void setTimeoutTime(int time) {
        int timeout = time;
        if (timeout == TCPRequestContext.NO_TIMEOUT) {
            this.timeoutTime = TCPRequestContext.NO_TIMEOUT;
            this.timeoutInterval = 0;
        } else {
            if (timeout == TCPRequestContext.USE_CHANNEL_TIMEOUT) {
                timeout = getConfig().getInactivityTimeout();
            }
            if (timeout != ValidateUtils.INACTIVITY_TIMEOUT_NO_TIMEOUT) {
                this.timeoutTime = System.currentTimeMillis() + timeout;
                this.timeoutInterval = timeout;
            } else {
                this.timeoutTime = TCPRequestContext.NO_TIMEOUT;
                this.timeoutInterval = 0;
            }
        }
    }
268320
public void connect(SocketAddress endpoint, int timeout) throws IOException {
    String filename;
    if (host == null || host.equals("localhost")) {
      filename = "\\\\.\\pipe\\" + name;
    } else {
      filename = "\\\\" + host + "\\pipe\\" + name;
    }

    //use a default timeout of 100ms if no timeout set.
    int usedTimeout = timeout == 0 ? 100 : timeout;
    long initialNano = System.nanoTime();
    do {
      try {
        file = new RandomAccessFile(filename, "rw");
        break;
      } catch (FileNotFoundException fileNotFoundException) {
        try {
          //using JNA if available
          Kernel32.INSTANCE.WaitNamedPipe(filename, timeout);
          //then retry connection
          file = new RandomAccessFile(filename, "rw");
        } catch (Throwable cle) {
          // in case JNA not on classpath, then wait 10ms before next try.
          if (System.nanoTime() - initialNano > TimeUnit.MILLISECONDS.toNanos(usedTimeout)) {
            if (timeout == 0) {
              throw new FileNotFoundException(fileNotFoundException.getMessage()
                  + "\nplease consider set connectTimeout option, so connection can retry having access to named pipe. "
                  + "\n(Named pipe can throw ERROR_PIPE_BUSY error)");
            }
            throw fileNotFoundException;
          }
          try {
            TimeUnit.MILLISECONDS.sleep(5);
          } catch (InterruptedException interrupted) {
            IOException ioException = new IOException(
                "Interruption during connection to named pipe");
            ioException.initCause(interrupted);
            throw ioException;
          }
        }
      }
    } while (true);

    is = new InputStream() {
      @Override
      public int read(byte[] bytes, int off, int len) throws IOException {
        return file.read(bytes, off, len);
      }

      @Override
      public int read() throws IOException {
        return file.read();
      }

      @Override
      public int read(byte[] bytes) throws IOException {
        return file.read(bytes);
      }
    };

    os = new OutputStream() {
      @Override
      public void write(byte[] bytes, int off, int len) throws IOException {
        file.write(bytes, off, len);
      }

      @Override
      public void write(int value) throws IOException {
        file.write(value);
      }

      @Override
      public void write(byte[] bytes) throws IOException {
        file.write(bytes);
      }
    };
  }
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();
    }
610718
public void setReadTimeout(int readTimeout) {
		this.client = this.client.newBuilder()
				.readTimeout(readTimeout, TimeUnit.MILLISECONDS)
				.build();
	}
283401
public void setTimeout(int timeout) {
        this.timeout = timeout;



        httpClient.connectTimeout(timeout, TimeUnit.MILLISECONDS);
        httpClient.readTimeout(timeout, TimeUnit.MILLISECONDS);
        httpClient.writeTimeout(timeout, TimeUnit.MILLISECONDS);

    }
1055751
public AndroidTerminateApplicationOptions withTimeout(Duration timeout) {
        checkArgument(!checkNotNull(timeout).isNegative(), "The timeout value cannot be negative");
        this.timeout = timeout;
        return this;
    }
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);
    }
  }
1163917
def timeout(self, timeout):
        '''
        '''
        if self._timeout is None:
            self.event('connection_made').bind(self._add_timeout)
            self.event('connection_lost').bind(self._cancel_timeout)
        self._timeout = timeout or 0
        self._add_timeout(None)