Package org.mockserver.client.proxy

Examples of org.mockserver.client.proxy.ProxyClient


    @BeforeClass
    public static void startServer() throws Exception {
        testServer.startServer(SERVER_HTTP_PORT, SERVER_HTTPS_PORT);

        // start client
        proxyClient = new ProxyClient("localhost", PROXY_HTTP_PORT);
    }
View Full Code Here


*/
public class ClientProxyMavenPluginStopTest {

    @Test(expected = RuntimeException.class)
    public void shouldNotBeAbleToReachProxy() {
        new ProxyClient("127.0.0.1", 9092).reset();
    }
View Full Code Here

    @BeforeClass
    public static void startServer() throws Exception {
        testServer.startServer(SERVER_HTTP_PORT, SERVER_HTTPS_PORT);

        // start client
        proxyClient = new ProxyClient("localhost", PROXY_HTTP_PORT);
    }
View Full Code Here

*/
public class ClientProxyMavenPluginStopTest {

    @Test(expected = RuntimeException.class)
    public void shouldNotBeAbleToReachProxy() {
        new ProxyClient("127.0.0.1", 9094).reset();
    }
View Full Code Here

        }
    }

    @VisibleForTesting
    ProxyClient newProxyClient(int proxyStopPort) {
        return new ProxyClient("127.0.0.1", proxyStopPort);
    }
View Full Code Here

    @Override
    public void testRunFinished(Result result) throws Exception {
        if (SystemProperties.proxyHttpPort() != -1) {
            logger.info("Stopping the MockServer proxy");
            new ProxyClient("127.0.0.1", SystemProperties.proxyHttpPort()).stop();
        } else {
            logger.info("Failed to stop MockServer proxy as HTTP port is unknown");
        }
    }
View Full Code Here

        new MockServerClient("127.0.0.1", 8096).reset();
    }

    @Test(expected = RuntimeException.class)
    public void shouldNotBeAbleToReachProxy() {
        new ProxyClient("127.0.0.1", 9100).reset();
    }
View Full Code Here

    @Test
    public void shouldVerifyRequests() throws Exception {
        // given
        HttpClient httpClient = createHttpClient();
        ProxyClient proxyClient = new ProxyClient("127.0.0.1", getProxyPort()).reset();

        // when
        httpClient.execute(
                new HttpGet(
                        new URIBuilder()
                                .setScheme("http")
                                .setHost("localhost")
                                .setPort(getServerPort())
                                .setPath("/test_headers_and_body")
                                .build()
                )
        );
        httpClient.execute(
                new HttpGet(
                        new URIBuilder()
                                .setScheme("http")
                                .setHost("localhost")
                                .setPort(getServerPort())
                                .setPath("/test_headers_only")
                                .build()
                )
        );

        // then
        proxyClient
                .verify(
                        request()
                                .withMethod("GET")
                                .withPath("/test_headers_and_body")
                );
        proxyClient
                .verify(
                        request()
                                .withMethod("GET")
                                .withPath("/test_headers_and_body"),
                        exactly(1)
                );
        proxyClient
                .verify(
                        request()
                                .withPath("/test_headers_.*"),
                        atLeast(1)
                );
        proxyClient
                .verify(
                        request()
                                .withPath("/test_headers_.*"),
                        exactly(2)
                );
        proxyClient
                .verify(
                        request()
                                .withPath("/other_path"),
                        exactly(0)
                );
View Full Code Here

    @Test(expected = AssertionError.class)
    public void shouldVerifyZeroRequests() throws Exception {
        // given
        HttpClient httpClient = createHttpClient();
        ProxyClient proxyClient = new ProxyClient("127.0.0.1", getProxyPort()).reset();

        // when
        httpClient.execute(
                new HttpGet(
                        new URIBuilder()
                                .setScheme("http")
                                .setHost("localhost")
                                .setPort(getServerPort())
                                .setPath("/test_headers_and_body")
                                .build()
                )
        );

        // then
        proxyClient
                .verify(
                        request()
                                .withMethod("GET")
                                .withPath("/test_headers_and_body"),
                        exactly(0)
View Full Code Here

    @BeforeClass
    public static void startServer() throws Exception {
        testServer.startServer(SERVER_HTTP_PORT, SERVER_HTTPS_PORT);

        // start client
        proxyClient = new ProxyClient("localhost", PROXY_HTTP_PORT);
    }
View Full Code Here

TOP

Related Classes of org.mockserver.client.proxy.ProxyClient

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.