Examples of executeRequest()


Examples of org.asynchttpclient.AsyncHttpClient.executeRequest()

        AsyncHttpClient ahc = getAsyncHttpClient(null);
        try {
            Request req = new RequestBuilder("GET").setUrl("http://localhost:" + port1 + "/MultiOther").build();
            final CountDownLatch latch = new CountDownLatch(1);
            ahc.executeRequest(req, new AsyncHandler<Void>() {
                public void onThrowable(Throwable t) {
                    t.printStackTrace(System.out);
                }

                public STATE onBodyPartReceived(HttpResponseBodyPart objectHttpResponseBodyPart) throws Exception {
View Full Code Here

Examples of org.asynchttpclient.AsyncHttpClient.executeRequest()

        AsyncHttpClient ahc = getAsyncHttpClient(null);
        try {
            Request req = new RequestBuilder("GET").setUrl("http://localhost:" + port1 + "/MultiEnt").build();
            final CountDownLatch latch = new CountDownLatch(1);
            ahc.executeRequest(req, new AsyncHandler<Void>() {
                public void onThrowable(Throwable t) {
                    t.printStackTrace(System.out);
                }

                public STATE onBodyPartReceived(HttpResponseBodyPart objectHttpResponseBodyPart) throws Exception {
View Full Code Here

Examples of org.asynchttpclient.AsyncHttpClient.executeRequest()

        .build();

        AsyncHttpClient asyncHttpClient = getAsyncHttpClient(config);
        try {
            RequestBuilder rb = new RequestBuilder("GET").setProxyServer(ps).setUrl(getTargetUrl2());
            Future<Response> responseFuture = asyncHttpClient.executeRequest(rb.build(), new AsyncCompletionHandlerBase() {

                public void onThrowable(Throwable t) {
                    t.printStackTrace();
                    logger.debug(t.getMessage(), t);
                }
View Full Code Here

Examples of org.asynchttpclient.AsyncHttpClient.executeRequest()

                .setProxyServer(new ProxyServer(ProxyServer.Protocol.HTTPS, "127.0.0.1", port1))//
                .setAcceptAnyCertificate(true)//
                .build();
        AsyncHttpClient asyncHttpClient = getAsyncHttpClient(config);
        try {
            Future<Response> responseFuture = asyncHttpClient.executeRequest(new RequestBuilder("GET").setUrl(getTargetUrl2()).build(), new AsyncCompletionHandlerBase() {

                public void onThrowable(Throwable t) {
                    t.printStackTrace();
                    logger.debug(t.getMessage(), t);
                }
View Full Code Here

Examples of org.asynchttpclient.AsyncHttpClient.executeRequest()

            // made buff in stream big enough to mark.
            builder.setBody(new InputStreamBodyGenerator(new BufferedInputStream(new FileInputStream(LARGE_IMAGE_FILE), 400000)));

            Request r = builder.build();

            Response response = c.executeRequest(r).get();
            if (500 == response.getStatusCode()) {
                StringBuilder sb = new StringBuilder();
                sb.append("==============\n");
                sb.append("500 response from call\n");
                sb.append("Headers:" + response.getHeaders() + "\n");
View Full Code Here

Examples of org.asynchttpclient.AsyncHttpClient.executeRequest()

                }
            };

            Request req = new RequestBuilder("GET").setUrl(getTargetUrl() + "?foo=bar").build();

            client.executeRequest(req, handler).get();

            if (!l.await(TIMEOUT, TimeUnit.SECONDS)) {
                fail("Timed out");
            }
        } finally {
View Full Code Here

Examples of org.asynchttpclient.AsyncHttpClient.executeRequest()

    @Test(groups = { "standalone", "default_provider" })
    public void asyncHttpClientConfigBeanTest() throws Exception {
        AsyncHttpClient client = getAsyncHttpClient(new AsyncHttpClientConfigBean().setUserAgent("test"));
        try {
            Response response = client.executeRequest(client.prepareGet(getTargetUrl()).build()).get();
            assertEquals(200, response.getStatusCode());
        } finally {
            client.close();
        }
    }
View Full Code Here

Examples of org.asynchttpclient.AsyncHttpClient.executeRequest()

        AsyncHttpClient client = getAsyncHttpClient(null);
        try {
            Request request = new RequestBuilder("GET").setUrl(getTargetUrl() + "?q=+%20x").build();
            assertEquals(request.getUrl(), getTargetUrl() + "?q=%20%20x");

            String url = client.executeRequest(request, new AsyncCompletionHandler<String>() {
                @Override
                public String onCompleted(Response response) throws Exception {
                    return response.getUri().toString();
                }
View Full Code Here

Examples of org.asynchttpclient.AsyncHttpClient.executeRequest()

    public void asyncProviderEncodingTest2() throws Exception {
        AsyncHttpClient client = getAsyncHttpClient(null);
        try {
            Request request = new RequestBuilder("GET").setUrl(getTargetUrl() + "").addQueryParam("q", "a b").build();

            String url = client.executeRequest(request, new AsyncCompletionHandler<String>() {
                @Override
                public String onCompleted(Response response) throws Exception {
                    return response.getUri().toString();
                }
View Full Code Here

Examples of org.asynchttpclient.AsyncHttpClient.executeRequest()

    public void emptyRequestURI() throws Exception {
        AsyncHttpClient client = getAsyncHttpClient(null);
        try {
            Request request = new RequestBuilder("GET").setUrl(getTargetUrl()).build();

            String url = client.executeRequest(request, new AsyncCompletionHandler<String>() {
                @Override
                public String onCompleted(Response response) throws Exception {
                    return response.getUri().toString();
                }
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.