Package ign.middleman.helpers

Examples of ign.middleman.helpers.SimpleWebClientListener


        }
    }


    WebResponse getWebResponse(final HttpServletRequest request, String url) throws IOException {
        return wcp.get().raw(request.getMethod(), url, getProxy(url), new SimpleWebClientListener() {
            @Override
            public void before(HttpURLConnection hurl) {
                super.before(hurl);
                try {
                    Enumeration enumeration = request.getHeaderNames();
View Full Code Here


    }


    public WebResponse getWebResponse(String url, final String method, final Map<String, List<String>> headers) throws IOException {
        Proxy via = getProxy(url);
        return wcp.get().raw(method, url, via, new SimpleWebClientListener() {
            @Override
            public void before(HttpURLConnection hurl) {
                super.before(hurl);
                if (headers != null) {
                    try {
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 notModifiedTestWithListener() throws IOException {
        WebClient wc = new WebClient();
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/not-modified", null, new SimpleWebClientListener());
        assertEquals(304, wr.getStatus());

    }
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 clientErrorTestWithListener() throws IOException {
        WebClient wc = new WebClient();
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/client-error", null, new SimpleWebClientListener());
        assertEquals(400, wr.getStatus());

    }
View Full Code Here

    }

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

    }
View Full Code Here

    }

    @Test
    public void slowServerTestWithListener() throws IOException {
        WebClient wc = new WebClient(5, 5);
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/slow", null, new SimpleWebClientListener() {
           

            @Override
            public void onException(Exception e, String error) {
                super.onException(e, error);
View Full Code Here

TOP

Related Classes of ign.middleman.helpers.SimpleWebClientListener

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.