Executes a DELETE request.

@param url            url of resource to delete
@param connectTimeout connection timeout in milliseconds.
@param readTimeout    read timeout in milliseconds.
@return {@link Delete}
421323
public static Delete delete(String url, int connectTimeout, int readTimeout) {
        try {
            return new Delete(url, connectTimeout, readTimeout);
        } catch (Exception e) {
            throw new HttpException("Failed URL: " + url, e);
        }
    }
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) {
        }
    }
415066
public static Post post(String url, byte[] content, int connectTimeout, int readTimeout) {

        try {
            return new Post(url, content, connectTimeout, readTimeout);
        } catch (Exception e) {
            throw new HttpException("Failed URL: " + url, e);
        }
    }
624951
private static HttpURLConnection openURLConnection(URL url) throws IOException {
		// This method should be moved to a utility class in BioJava 5.0

		final int timeout = 5000;
		final String useragent = "BioJava";

		HttpURLConnection conn = (HttpURLConnection) url.openConnection();
		conn.setRequestProperty("User-Agent", useragent);
		conn.setInstanceFollowRedirects(true);
		conn.setConnectTimeout(timeout);
		conn.setReadTimeout(timeout);

		int status = conn.getResponseCode();
		while (status == HttpURLConnection.HTTP_MOVED_TEMP
				|| status == HttpURLConnection.HTTP_MOVED_PERM
				|| status == HttpURLConnection.HTTP_SEE_OTHER) {
			// Redirect!
			String newUrl = conn.getHeaderField("Location");

			if(newUrl.equals(url.toString())) {
				throw new IOException("Cyclic redirect detected at "+newUrl);
			}

			// Preserve cookies
			String cookies = conn.getHeaderField("Set-Cookie");

			// open the new connection again
			url = new URL(newUrl);
			conn.disconnect();
			conn = (HttpURLConnection) url.openConnection();
			if(cookies != null) {
				conn.setRequestProperty("Cookie", cookies);
			}
			conn.addRequestProperty("User-Agent", useragent);
			conn.setInstanceFollowRedirects(true);
			conn.setConnectTimeout(timeout);
			conn.setReadTimeout(timeout);
			conn.connect();

			status = conn.getResponseCode();

			logger.info("Redirecting from {} to {}", url, newUrl);
		}
		conn.connect();

		return conn;
	}
403817
public AsyncHttpClientBuilder setTimeout(int timeout) {
        requestConfigBuilder.setConnectTimeout(timeout);
        requestConfigBuilder.setSocketTimeout(timeout);
        requestConfigBuilder.setConnectionRequestTimeout(timeout);
        return this;
    }
206786
public static HttpResponse executeGet(final String url) {
        try {
            return executeGet(url, null, null, new LinkedHashMap<>());
        } catch (final Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        return null;
    }
348078
protected HttpURLConnection openConnection(String url) throws IOException {
    HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
    connection.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT_MILLIS);
    connection.setReadTimeout(DEFAULT_READ_TIMEOUT_MILLIS);
    connection.setRequestProperty("Content-Type", "application/json");
    connection.setRequestProperty("User-Agent", USER_AGENT);
    connection.setDoInput(true);
    return connection;
  }
1350302
public static Response delete(String url, Map<String, String> query) throws HttpException {

		return delete(url, query, null, DEFAULT_CONNECT_TIMEOUT, DEFAULT_READ_TIMEOUT);
	}
14332
public NextResponse delete(final String url, final Map<String, String> queries)
            throws IOException {
        return delete(url, queries, null);
    }
832420
public void setConnectTimeout(int timeout) {
		Assert.isTrue(timeout >= 0, "Timeout must be a non-negative value");
		this.connectTimeout = timeout;
		setLegacyConnectionTimeout(getHttpClient(), timeout);
	}
465706
public static Get get(String url, int connectTimeout, int readTimeout) {

        try {
            return new Get(url, connectTimeout, readTimeout);
        } catch (Exception e) {
            throw new HttpException("Failed URL: " + url, e);
        }
    }
561194
public static URLConnection open(URL url) throws IOException {
        final ProxyConfiguration p = get();
        
        URLConnection con;
        if(p==null) {
            con = url.openConnection();
        } else {
            Proxy proxy = p.createProxy(url.getHost());
            con = url.openConnection(proxy);
            if(p.getUserName()!=null) {
                // Add an authenticator which provides the credentials for proxy authentication
                Authenticator.setDefault(p.authenticator);
                p.jenkins48775workaround(proxy, url);
            }
        }
        
        if(DEFAULT_CONNECT_TIMEOUT_MILLIS > 0) {
            con.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT_MILLIS);
        }
        
        if (JenkinsJVM.isJenkinsJVM()) { // this code may run on a slave
            decorate(con);
        }

        return con;
    }
435683
public synchronized boolean connect ( long timeout ) throws TransportException {
        int st = this.state;
        try {
            switch ( st ) {
            case 0:
                break;
            case 1:
                // already connecting
                this.thread.wait(timeout); /* wait for doConnect */
                st = this.state;
                switch ( st ) {
                case 1: /* doConnect never returned */
                    this.state = 6;
                    cleanupThread(timeout);
                    throw new ConnectionTimeoutException("Connection timeout");
                case 2:
                    if ( this.te != null ) { /* doConnect throw Exception */
                        this.state = 4; /* error */
                        cleanupThread(timeout);
                        throw this.te;
                    }
                    this.state = 3; /* Success! */
                    return true;
                }
                break;
            case 3:
                return true; // already connected
            case 4:
                this.state = 6;
                throw new TransportException("Connection in error", this.te);
            case 5:
            case 6:
                log.debug("Trying to connect a disconnected transport");
                return false;
            default:
                TransportException tex = new TransportException("Invalid state: " + st);
                throw tex;
            }

            if ( log.isDebugEnabled() ) {
                log.debug("Connecting " + this.name);
            }

            this.state = 1;
            this.te = null;

            Thread t = new Thread(this, this.name);
            t.setDaemon(true);
            this.thread = t;

            synchronized ( this.thread ) {
                t.start();
                t.wait(timeout); /* wait for doConnect */

                st = this.state;
                switch ( st ) {
                case 1: /* doConnect never returned */
                    this.state = 6;
                    throw new ConnectionTimeoutException("Connection timeout");
                case 2:
                    if ( this.te != null ) { /* doConnect throw Exception */
                        this.state = 4; /* error */
                        throw this.te;
                    }
                    this.state = 3; /* Success! */
                    return true;
                case 3:
                    return true;
                default:
                    return false;
                }
            }
        }
        catch ( ConnectionTimeoutException e ) {
            cleanupThread(timeout);
            // allow to retry the connection
            this.state = 0;
            throw e;
        }
        catch ( InterruptedException ie ) {
            this.state = 6;
            cleanupThread(timeout);
            throw new TransportException(ie);
        }
        catch ( TransportException e ) {
            cleanupThread(timeout);
            throw e;
        }
        finally {
            /*
             * This guarantees that we leave in a valid state
             */
            st = this.state;
            if ( st != 0 && st != 3 && st != 4 && st != 5 && st != 6 ) {
                log.error("Invalid state: " + st);
                this.state = 6;
                cleanupThread(timeout);
            }
        }
    }
1052870
private static RequestConfig getRequestConfig(Integer readTimeoutInMillis) {
        return RequestConfig.custom().setConnectionRequestTimeout(600)
                .setConnectTimeout(XianConfig.getIntValue("apache.httpclient.connectTimeout", 600))
                .setSocketTimeout(readTimeoutInMillis).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()));			
		}
	}
308682
public static String doPost(String url, Map<String, String> params, int connectTimeout, int readTimeout) throws IOException {
        return doPost(url, params, DEFAULT_CHARSET, connectTimeout, readTimeout);
    }
1100633
public static RequestResponse callHttpDelete(HttpJsonRpcClient client, String url,
            Map<String, Object> headers, Map<String, Object> urlParams) {
        return client.doDelete(url, headers, urlParams);
    }