Examples of SimpleHttpServer


Examples of org.apache.axis2.transport.http.SimpleHTTPServer


    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);

   
    httpServer = new SimpleHTTPServer (configContext,serverPort);
    httpServer.start();
    try {
      Thread.sleep(300);
    } catch (InterruptedException e) {
      throw new SandeshaException ("sleep interupted");
View Full Code Here

Examples of org.apache.axis2.transport.http.server.SimpleHttpServer

    /**
     * Start this server as a NON-daemon.
     */
    public void start() throws AxisFault {
        try {
            embedded = new SimpleHttpServer(httpFactory, port);
            embedded.init();
            embedded.start();
        } catch (IOException e) {
            log.error(e.getMessage(), e);
            throw AxisFault.makeFault(e);
View Full Code Here

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

        } else {
            serversocketfactory = new SimplePlainSocketFactory();
            testhttp = Protocol.getProtocol("http");
        }

        this.server = new SimpleHttpServer(serversocketfactory, 0); // use arbitrary port
        this.server.setTestname(getName());

        this.client = new HttpClient();

        this.client.getHostConfiguration().setHost(
View Full Code Here

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

    // ----------------------------------------------------------- Test Methods

    public void setUp() throws IOException {
        client = new HttpClient();
        server = new SimpleHttpServer(); // use arbitrary port
        server.setTestname(getName());
        server.setRequestHandler(new MyHttpRequestHandler());
    }
View Full Code Here

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

    }

   
    public void testDigestAuthenticationWithStaleNonce() throws Exception {
        // configure the server
        SimpleHttpServer server = new SimpleHttpServer(); // use arbitrary port
        server.setTestname(getName());
        server.setHttpService(new StaleNonceService());

        // configure the client
        HttpClient client = new HttpClient();
        client.getHostConfiguration().setHost(
                server.getLocalAddress(), server.getLocalPort(),
                Protocol.getProtocol("http"));
       
        client.getState().setCredentials(AuthScope.ANY,
                new UsernamePasswordCredentials("username","password"));
       
        FakeHttpMethod httpget = new FakeHttpMethod("/");
        try {
            client.executeMethod(httpget);
        } finally {
            httpget.releaseConnection();
        }
        assertNotNull(httpget.getStatusLine());
        assertEquals(HttpStatus.SC_OK, httpget.getStatusLine().getStatusCode());
        Map table = AuthChallengeParser.extractParams(
                httpget.getRequestHeader("Authorization").getValue());
        assertEquals("username", table.get("username"));
        assertEquals("realm1", table.get("realm"));
        assertEquals("/", table.get("uri"));
        assertEquals("321CBA", table.get("nonce"));
        assertEquals("7f5948eefa115296e9279225041527b3", table.get("response"));
        server.destroy();
    }
View Full Code Here

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

    public void testCrossSiteRedirect() throws IOException {
        String host = this.server.getLocalAddress();
        int port = this.server.getLocalPort();
       
        SimpleHttpServer thatserver = new SimpleHttpServer();
        this.server.setHttpService(new BasicRedirectService(host, port));
        thatserver.setHttpService(new BasicRedirectService(host, port));
        thatserver.setTestname(getName());
       
        HostConfiguration hostconfig = new HostConfiguration();
        hostconfig.setHost(
                thatserver.getLocalAddress(),
                thatserver.getLocalPort(),
                Protocol.getProtocol("http"));

        GetMethod httpget = new GetMethod("/oldlocation/");
        httpget.setFollowRedirects(true);
        try {
            this.client.executeMethod(hostconfig, httpget);
            assertEquals(HttpStatus.SC_OK, httpget.getStatusCode());
            assertEquals("/newlocation/", httpget.getPath());
            assertEquals(host, httpget.getURI().getHost());
            assertEquals(port, httpget.getURI().getPort());
            assertEquals(new URI("http://" + host + ":" + port + "/newlocation/", false),
                    httpget.getURI());
        } finally {
            httpget.releaseConnection();
        }
        thatserver.destroy();
    }
View Full Code Here

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

    // ------------------------------------------------- TestCase setup/shutdown

    public void setUp() throws IOException {
        // configure the server
        this.server = new SimpleHttpServer(); // use arbitrary port

        // configure the client
        this.client = new HttpClient();
        this.client.getHostConfiguration().setHost(
            this.server.getLocalAddress(),
View Full Code Here

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

    // ----------------------------------------------------------- Test Methods

    public void setUp() throws IOException {
        client = new HttpClient();
        server = new SimpleHttpServer(); // use arbitrary port
        server.setRequestHandler(new MyHttpRequestHandler());
    }
View Full Code Here

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

    }

   
    public void testDigestAuthenticationWithStaleNonce() throws Exception {
        // configure the server
        SimpleHttpServer server = new SimpleHttpServer(); // use arbitrary port
        server.setTestname(getName());
        server.setHttpService(new StaleNonceService());

        // configure the client
        HttpClient client = new HttpClient();
        client.getHostConfiguration().setHost(
                server.getLocalAddress(), server.getLocalPort(),
                Protocol.getProtocol("http"));
       
        client.getState().setCredentials(AuthScope.ANY,
                new UsernamePasswordCredentials("username","password"));
       
        FakeHttpMethod httpget = new FakeHttpMethod("/");
        try {
            client.executeMethod(httpget);
        } finally {
            httpget.releaseConnection();
        }
        assertNotNull(httpget.getStatusLine());
        assertEquals(HttpStatus.SC_OK, httpget.getStatusLine().getStatusCode());
        Map table = AuthChallengeParser.extractParams(
                httpget.getRequestHeader("Authorization").getValue());
        assertEquals("username", table.get("username"));
        assertEquals("realm1", table.get("realm"));
        assertEquals("/", table.get("uri"));
        assertEquals("321CBA", table.get("nonce"));
        assertEquals("7f5948eefa115296e9279225041527b3", table.get("response"));
        server.destroy();
    }
View Full Code Here

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

    }
   
    // ------------------------------------------------- TestCase setup/shutdown

    public void setUp() throws IOException {
        this.server = new SimpleHttpServer(); // use arbitrary port
        this.server.setTestname(getName());

        this.client = new HttpClient();
        this.client.getHostConfiguration().setHost(
            this.server.getLocalAddress(),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.