Package ign.middleman.helpers

Examples of ign.middleman.helpers.WebClient.raw()


    @Test
    public void proxyTest() throws IOException {
        WebClient wc = new WebClient();
        Proxy via = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("localhost", port));
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/ok", via, null);
        assertEquals(200, wr.getStatus());
    }

    @Test
    public void okTest() throws IOException {
View Full Code Here


    }

    @Test
    public void okTest() throws IOException {
        WebClient wc = new WebClient();
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/ok", null, null);
        assertEquals(200, wr.getStatus());
        assertEquals("GET", wr.getMethod());
        assertEquals("OK", wr.getMessage());
        assertEquals("text/plain; charset=utf-8", wr.getHeaders().get("Content-Type").get(0));
        assertEquals("Hello World", new String(wr.getBody()));
View Full Code Here

    }

    @Test
    public void okTestWithListener() throws IOException {
        WebClient wc = new WebClient();
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/ok", null, new SimpleWebClientListener());
        assertEquals(200, wr.getStatus());
        assertEquals("OK", wr.getMessage());
        assertEquals("text/plain; charset=utf-8", wr.getHeaders().get("Content-Type").get(0));
        assertEquals("Hello World", new String(wr.getBody()));
View Full Code Here

    }

    @Test
    public void notModifiedTest() throws IOException {
        WebClient wc = new WebClient();
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/not-modified", null, null);
        assertEquals(304, wr.getStatus());

    }

    @Test
View Full Code Here

    }

    @Test
    public void notModifiedTestWithListener() throws IOException {
        WebClient wc = new WebClient();
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/not-modified", null, new SimpleWebClientListener());
        assertEquals(304, wr.getStatus());

    }

    @Test
View Full Code Here

    }

    @Test
    public void notFoundTest() throws IOException {
        WebClient wc = new WebClient();
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/not-found", null, null);
        assertEquals(404, wr.getStatus());
        assertEquals("Not Found", wr.getMessage());
        assertEquals("text/html; charset=utf-8", wr.getHeaders().get("Content-Type").get(0));
        assertEquals("Hello World", new String(wr.getBody()));
View Full Code Here

    }

    @Test
    public void notFoundTestWithListener() throws IOException {
        WebClient wc = new WebClient();
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/not-found", null, new SimpleWebClientListener());
        assertEquals(404, wr.getStatus());
        assertEquals("Not Found", wr.getMessage());
        assertEquals("text/html; charset=utf-8", wr.getHeaders().get("Content-Type").get(0));
        assertEquals("Hello World", new String(wr.getBody()));
View Full Code Here

    }

    @Test
    public void clientError() throws IOException {
        WebClient wc = new WebClient();
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/client-error", null, null);
       
        assertEquals(400, wr.getStatus());

    }
View Full Code Here

    }

    @Test
    public void clientErrorTestWithListener() throws IOException {
        WebClient wc = new WebClient();
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/client-error", null, new SimpleWebClientListener());
        assertEquals(400, wr.getStatus());

    }

    @Test
View Full Code Here

    }

    @Test
    public void serverError() throws IOException {
        WebClient wc = new WebClient();
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/server-error", null, null);
        assertEquals(503, wr.getStatus());

    }

    @Test
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.