Examples of SimpleHttpServer


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.eclipse.jgit.junit.http.SimpleHttpServer

    uri = "git://localhost:" + d.getAddress().getPort() + "/" + REPO_NAME
        + Constants.DOT_GIT_EXT;
  }

  private void serveHttp() throws Exception{
    httpServer = new SimpleHttpServer(src.getRepository());
    httpServer.start();
    uri = httpServer.getUri().toString();
  }
View Full Code Here

Examples of org.wso2.esb.integration.http.SimpleHttpServer

    }

    @Override
    public void successfulScenario() throws RemoteException {
        updateESBConfiguration("/soap_2_pox.xml");
        SimpleHttpServer httpServer = new SimpleHttpServer();
        try {
            httpServer.start();
        } catch (IOException e) {
            handleError("Error while starting the HTTP server", e);
        }

        TestRequestInterceptor interceptor = new TestRequestInterceptor();
        httpServer.getRequestHandler().setInterceptor(interceptor);

        try {
            OMElement response = axis2Client.sendSimpleStockQuoteRequest(
                    getProxyServiceURL("SOAP2POX", true),
                    "http://localhost:9000/services/SimpleStockQuoteService", "WSO2");
            log.info("Response received: " + response);
            assertEquals("/services/SimpleStockQuoteService", interceptor.getLastRequestURI());
        } catch (AxisFault axisFault) {
            handleError("Error while invoking the SOAP2POX proxy", axisFault);
        }

        try {
            httpServer.stop();
        } catch (IOException e) {
            log.warn("Error while shutting down the HTTP server", e);
        }
    }
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.