Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.ConnectMethod


           
       
            ProxyClient.ConnectResponse response = client.connect();
            socket = response.getSocket();
            if (socket == null) {
                ConnectMethod method = response.getConnectMethod();
                // Read the proxy's HTTP response.
                if(method.getStatusLine().toString().matches("HTTP/1\\.\\d 407 Proxy Authentication Required")) {
                    // Proxy server returned 407. We will now try to connect with auth Header
                    if(proxyUsername != null && proxyPassword != null) {
                        socket = AuthenticateProxy(method, client,proxyHost, proxyAddress.getPort(),
                                proxyUsername, proxyPassword);
                    } else {
                        throw new ProtocolException("Socket not created: " + method.getStatusLine());
                    }
                }            
            }
           
        } catch (Exception e) {
View Full Code Here


        // Set the timeout (if non-zero)
        httpConn.setSoTimeout(JMeterUtils.getPropDefault("httpclient.timeout",0));

        httpState = new HttpState();
        if (httpConn.isProxied() && httpConn.isSecure()) {
            httpMethod = new ConnectMethod(httpMethod);
        }
       
        // Allow HttpClient to handle the redirects:
        httpMethod.setFollowRedirects(getPropertyAsBoolean(AUTO_REDIRECTS));
       
View Full Code Here

        // TODO make this a JMeter property
        httpMethod.setHttp11(!System.getProperty("http.version","1.1").equals("1.0"));

        httpState = new HttpState();
        if (httpConn.isProxied() && httpConn.isSecure()) {
            httpMethod = new ConnectMethod(httpMethod);
        }
       
        // Allow HttpClient to handle the redirects:
        httpMethod.setFollowRedirects(getPropertyAsBoolean(AUTO_REDIRECTS));
       
View Full Code Here

    // Set the timeout (if non-zero)
    httpConn.setSoTimeout(JMeterUtils.getPropDefault("httpclient.timeout", 0));

    httpState = new HttpState();
    if (httpConn.isProxied() && httpConn.isSecure()) {
      httpMethod = new ConnectMethod(httpMethod);
    }

    // Allow HttpClient to handle the redirects:
    httpMethod.setFollowRedirects(getPropertyAsBoolean(AUTO_REDIRECTS));
View Full Code Here

            } else if (method.equalsIgnoreCase(Method.DELETE.getName())) {
                this.httpMethod = new DeleteMethod(requestUri);
            } else if (method.equalsIgnoreCase(Method.CONNECT.getName())) {
                final HostConfiguration host = new HostConfiguration();
                host.setHost(new URI(requestUri, false));
                this.httpMethod = new ConnectMethod(host);
            } else if (method.equalsIgnoreCase(Method.OPTIONS.getName())) {
                this.httpMethod = new OptionsMethod(requestUri);
            } else if (method.equalsIgnoreCase(Method.TRACE.getName())) {
                this.httpMethod = new TraceMethod(requestUri);
            } else {
View Full Code Here

            } else if (method.equalsIgnoreCase(Method.DELETE.getName())) {
                this.httpMethod = new DeleteMethod(requestUri);
            } else if (method.equalsIgnoreCase(Method.CONNECT.getName())) {
                final HostConfiguration host = new HostConfiguration();
                host.setHost(new URI(requestUri, false));
                this.httpMethod = new ConnectMethod(host);
            } else if (method.equalsIgnoreCase(Method.OPTIONS.getName())) {
                this.httpMethod = new OptionsMethod(requestUri);
            } else if (method.equalsIgnoreCase(Method.TRACE.getName())) {
                this.httpMethod = new TraceMethod(requestUri);
            } else {
View Full Code Here

                System.getProperty("http.proxyUserName"),
                System.getProperty("http.proxyPassword")));
        }

        if (connection.isProxied() && connection.isSecure()) {
            method = new ConnectMethod(method);
        }
        method.execute(state, connection);

        if (method.getStatusCode() == HttpStatus.SC_OK) {
            System.out.println(method.getResponseBodyAsString());
View Full Code Here

                System.getProperty("http.proxyUserName"),
                System.getProperty("http.proxyPassword")));
        }

        if (connection.isProxied() && connection.isSecure()) {
            method = new ConnectMethod(method);
        }
        method.execute(state, connection);

        if (method.getStatusCode() == HttpStatus.SC_OK) {
            System.out.println(method.getResponseBodyAsString());
View Full Code Here

                System.getProperty("http.proxyUserName"),
                System.getProperty("http.proxyPassword")));
        }

        if (connection.isProxied() && connection.isSecure()) {
            method = new ConnectMethod(method);
        }
        method.execute(state, connection);

        if (method.getStatusCode() == HttpStatus.SC_OK) {
            System.out.println(method.getResponseBodyAsString());
View Full Code Here

    // Set the timeout (if non-zero)
    httpConn.setSoTimeout(JMeterUtils.getPropDefault("httpclient.timeout", 0));

    httpState = new HttpState();
    if (httpConn.isProxied() && httpConn.isSecure()) {
      httpMethod = new ConnectMethod(httpMethod);
    }

    // Allow HttpClient to handle the redirects:
    httpMethod.setFollowRedirects(getPropertyAsBoolean(AUTO_REDIRECTS));
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.ConnectMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.