Search in sources :

Example 1 with SimpleSocketFactory

use of org.apache.commons.httpclient.server.SimpleSocketFactory in project ecf by eclipse.

the class HttpClientTestBase method setUp.

// ------------------------------------------------- TestCase setup/shutdown
public void setUp() throws IOException {
    // Configure socket factories
    SimpleSocketFactory serversocketfactory = null;
    Protocol testhttp = null;
    /* XXX removed because ssl test code not included
        if (this.useSSL) {
            serversocketfactory = new SimpleSSLSocketFactory(); 
            testhttp = new Protocol("https", 
                    (ProtocolSocketFactory)new SimpleSSLTestProtocolSocketFactory(), 443);
        } else {
            serversocketfactory = new SimplePlainSocketFactory(); 
            testhttp = Protocol.getProtocol("http"); 
        }
		*/
    // use arbitrary port
    this.server = new SimpleHttpServer(serversocketfactory, 0);
    this.server.setTestname(getName());
    this.client = new HttpClient();
    this.client.getHostConfiguration().setHost(this.server.getLocalAddress(), this.server.getLocalPort(), testhttp);
    if (this.useProxy) {
        this.proxy = new SimpleProxy();
        client.getHostConfiguration().setProxy(proxy.getLocalAddress(), proxy.getLocalPort());
    }
}
Also used : SimpleHttpServer(org.apache.commons.httpclient.server.SimpleHttpServer) Protocol(org.apache.commons.httpclient.protocol.Protocol) SimpleSocketFactory(org.apache.commons.httpclient.server.SimpleSocketFactory) SimpleProxy(org.apache.commons.httpclient.server.SimpleProxy)

Aggregations

Protocol (org.apache.commons.httpclient.protocol.Protocol)1 SimpleHttpServer (org.apache.commons.httpclient.server.SimpleHttpServer)1 SimpleProxy (org.apache.commons.httpclient.server.SimpleProxy)1 SimpleSocketFactory (org.apache.commons.httpclient.server.SimpleSocketFactory)1