Package org.apache.commons.httpclient.server

Examples of org.apache.commons.httpclient.server.SimpleProxy


                this.server.getLocalAddress(),
                this.server.getLocalPort(),
                testhttp);
       
        if (this.useProxy) {
            this.proxy = new SimpleProxy();
            client.getHostConfiguration().setProxy(
                proxy.getLocalAddress(),
                proxy.getLocalPort());               
        }
    }
View Full Code Here


        TARGET_HOST = System.getProperty("httpclient.test.localHost", "localhost");
        TARGET_PORT = Integer.parseInt(System.getProperty("httpclient.test.localPort", "8080"));
    }

    public void testSimpleGet() throws Exception {
        SimpleProxy proxy = new SimpleProxy();

        HttpClient client = new HttpClient();
        HostConfiguration hc = new HostConfiguration();
        hc.setHost(TARGET_HOST, TARGET_PORT, Protocol.getProtocol("http"));
        hc.setProxy(proxy.getLocalAddress(), proxy.getLocalPort());
        client.setHostConfiguration(hc);

        GetMethod get = new GetMethod("/");
        client.executeMethod(get);
        assertEquals(200, get.getStatusCode());
View Full Code Here

        get.releaseConnection();
    }

    public void testAuthGet() throws Exception {
        Credentials creds = new UsernamePasswordCredentials("user", "password");
        SimpleProxy proxy = new SimpleProxy();
        proxy.requireCredentials(creds);

        HttpClient client = new HttpClient();
        HostConfiguration hc = new HostConfiguration();
        hc.setHost(TARGET_HOST, TARGET_PORT, Protocol.getProtocol("http"));
        hc.setProxy(proxy.getLocalAddress(), proxy.getLocalPort());
        client.setHostConfiguration(hc);
        client.getState().setProxyCredentials(AuthScope.ANY, creds);

        GetMethod get = new GetMethod("/");
        client.executeMethod(get);
View Full Code Here

        this.client.getHostConfiguration().setHost(
            this.server.getLocalAddress(),
            this.server.getLocalPort(),
            Protocol.getProtocol("http"));
        if (useProxy) {
            this.proxy = new SimpleProxy();
            client.getHostConfiguration().setProxy(
                proxy.getLocalAddress(),
                proxy.getLocalPort());               
        }
    }
View Full Code Here

    }

    protected void setUp() throws Exception {
        super.setUp();
        this.httpclient = new HttpClient();
        this.proxy = new SimpleProxy();
        this.httpclient.getHostConfiguration().setProxy(
                this.proxy.getLocalAddress(),
                this.proxy.getLocalPort());

        SimpleSocketFactory serversocketfactory = null;
View Full Code Here

    System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "debug");
    */
  }
 
  public void testSimpleGet() throws Exception {
    SimpleProxy proxy = new SimpleProxy();
   
    HttpClient client = new HttpClient();
    HostConfiguration hc = new HostConfiguration();
    hc.setHost("localhost", 8080, Protocol.getProtocol("http"));
    hc.setProxy(proxy.getLocalAddress(), proxy.getLocalPort());
    client.setHostConfiguration(hc);
   
    GetMethod get = new GetMethod("/");
    client.executeMethod(get);
    assertEquals(200, get.getStatusCode());
View Full Code Here

    get.releaseConnection();
  }
 
  public void testAuthGet() throws Exception {
    Credentials creds = new UsernamePasswordCredentials("user", "password");
    SimpleProxy proxy = new SimpleProxy();
    proxy.requireCredentials(creds);
   
    HttpClient client = new HttpClient();
    HostConfiguration hc = new HostConfiguration();
    hc.setHost("localhost", 8080, Protocol.getProtocol("http"));
    hc.setProxy(proxy.getLocalAddress(), proxy.getLocalPort());
    client.setHostConfiguration(hc);
    client.getState().setProxyCredentials(null, null, creds);
   
    GetMethod get = new GetMethod("/");
    client.executeMethod(get);
View Full Code Here

        this.client.getHostConfiguration().setHost(
            this.server.getLocalAddress(),
            this.server.getLocalPort(),
            Protocol.getProtocol("http"));
        if (useProxy) {
            this.proxy = new SimpleProxy();
            client.getHostConfiguration().setProxy(
                proxy.getLocalAddress(),
                proxy.getLocalPort());               
        }
    }
View Full Code Here

        return new TestSuite(TestProxy.class);
    }

    protected void setUp() throws Exception {
        super.setUp();
        this.proxy = new SimpleProxy();
        this.httpserver = new SimpleHttpServer();
        this.httpclient = new HttpClient();
        this.httpclient.getHostConfiguration().setHost(
                this.httpserver.getLocalAddress(),
                this.httpserver.getLocalPort(),
View Full Code Here

        }
    }

    public void testAbsoluteURLOverridesDefaultHostParam() throws IOException {

        this.proxy = new SimpleProxy();
       
        this.server.setHttpService(new EchoService());
        // reset default host configuration
        HostConfiguration hostconfig = new HostConfiguration();
        hostconfig.setHost("somehwere.outthere.in.pampa", 9999);
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.server.SimpleProxy

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.