Examples of AsyncCompletionHandlerBase


Examples of com.ning.http.client.AsyncCompletionHandlerBase

        Request request = setupHttpRequest(cr, ncos, os);
        Response response;

        try {
            response = asyncHttpClient.executeRequest(request, new AsyncCompletionHandlerBase()
            {
                @Override
                public Response onCompleted(final Response response) throws Exception {
                    logger.debug("Response received: {}", response);
                    return super.onCompleted(response);
View Full Code Here

Examples of com.ning.http.client.AsyncCompletionHandlerBase

        Request request = setupHttpRequest(cr, ncos, os);
        Response response;
        final AtomicReference<Throwable> failureHolder = new AtomicReference<Throwable>();

        try {
            response = asyncHttpClient.executeRequest(request, new AsyncCompletionHandlerBase()
            {
                @Override
                public Response onCompleted(final Response response) throws Exception {
                    logger.trace("Response received: {}", response);
                    return super.onCompleted(response);
View Full Code Here

Examples of com.ning.http.client.AsyncCompletionHandlerBase

            final AsyncHttpClient client = new AsyncHttpClient();

            Future<Response> newVersionResponse = client.prepareGet(newVersionUrl)
                    .addHeader(AUTHORIZATION, BASIC + " " + encodedLogon)
                    .execute(
                    new AsyncCompletionHandlerBase() {
                        @Override
                        public Response onCompleted(Response response) throws Exception {

                            // First check the new version doesn't exist
                            if (response.getStatusCode() == 404) {
View Full Code Here

Examples of com.ning.http.client.AsyncCompletionHandlerBase

    */
   protected void executeRequest(AsyncHttpClient client, Request request) throws InterruptedException, ExecutionException, TimeoutException,
         IOException
   {
      final CountDownLatch l = new CountDownLatch(1);
      client.executeRequest(request, new AsyncCompletionHandlerBase()
      {
         @Override
         public Response onCompleted(Response response) throws Exception
         {
            Assert.assertEquals(200, response.getStatusCode());
View Full Code Here

Examples of com.ning.http.client.AsyncCompletionHandlerBase

    */
   protected void executeRequest(AsyncHttpClient client, Request request) throws InterruptedException, ExecutionException, TimeoutException,
         IOException
   {
      final CountDownLatch l = new CountDownLatch(1);
      client.executeRequest(request, new AsyncCompletionHandlerBase()
      {
         @Override
         public Response onCompleted(Response response) throws Exception
         {
            Assert.assertEquals(200, response.getStatusCode());
View Full Code Here

Examples of org.asynchttpclient.AsyncCompletionHandlerBase

        AsyncHttpClient client = getAsyncHttpClient(null);
        try {
            final CountDownLatch l = new CountDownLatch(1);
            Request request = new RequestBuilder("HEAD").setUrl("http://127.0.0.1:" + port1 + "/Test").build();

            client.executeRequest(request, new AsyncCompletionHandlerBase() {
                @Override
                public Response onCompleted(Response response) throws Exception {
                    l.countDown();
                    return super.onCompleted(response);
                }
View Full Code Here

Examples of org.asynchttpclient.AsyncCompletionHandlerBase

    @Test(groups = { "standalone", "default_provider" })
    public void postWithNulParamQS() throws IOException, ExecutionException, TimeoutException, InterruptedException {
        AsyncHttpClient client = getAsyncHttpClient(null);
        try {
            Future<Response> f = client.preparePost("http://127.0.0.1:" + port1 + "/?a=").setBody("abc".getBytes()).execute(new AsyncCompletionHandlerBase() {

                @Override
                public STATE onStatusReceived(final HttpResponseStatus status) throws Exception {
                    if (!status.getUri().toUrl().equals("http://127.0.0.1:" + port1 + "/?a=")) {
                        throw new IOException(status.getUri().toUrl());
View Full Code Here

Examples of org.asynchttpclient.AsyncCompletionHandlerBase

    @Test(groups = { "standalone", "default_provider" })
    public void postWithNulParamsQS() throws IOException, ExecutionException, TimeoutException, InterruptedException {
        AsyncHttpClient client = getAsyncHttpClient(null);
        try {
            Future<Response> f = client.preparePost("http://127.0.0.1:" + port1 + "/?a=b&c&d=e").setBody("abc".getBytes()).execute(new AsyncCompletionHandlerBase() {

                @Override
                public STATE onStatusReceived(final HttpResponseStatus status) throws Exception {
                    if (!status.getUri().toUrl().equals("http://127.0.0.1:" + port1 + "/?a=b&c&d=e")) {
                        throw new IOException("failed to parse the query properly");
View Full Code Here

Examples of org.asynchttpclient.AsyncCompletionHandlerBase

    @Test(groups = { "standalone", "default_provider" })
    public void postWithEmptyParamsQS() throws IOException, ExecutionException, TimeoutException, InterruptedException {
        AsyncHttpClient client = getAsyncHttpClient(null);
        try {
            Future<Response> f = client.preparePost("http://127.0.0.1:" + port1 + "/?a=b&c=&d=e").setBody("abc".getBytes()).execute(new AsyncCompletionHandlerBase() {

                @Override
                public STATE onStatusReceived(final HttpResponseStatus status) throws Exception {
                    if (!status.getUri().toUrl().equals("http://127.0.0.1:" + port1 + "/?a=b&c=&d=e")) {
                        throw new IOException("failed to parse the query properly");
View Full Code Here

Examples of org.asynchttpclient.AsyncCompletionHandlerBase

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