Examples of prepareGet()


Examples of com.ning.http.client.AsyncHttpClient.prepareGet()

    int iterations = 100;
    final CountDownLatch latch = new CountDownLatch(iterations);
    AsyncHttpClient asyncHttpClient = new AsyncHttpClient();
    for (int i = 1; i <= iterations; i++) {

      asyncHttpClient.prepareGet("http://localhost:" + PORT + "/").
      execute(new AsyncCompletionHandler<com.ning.http.client.Response>(){

        @Override
        public com.ning.http.client.Response onCompleted(com.ning.http.client.Response response) throws Exception{
          String body = response.getResponseBody();
View Full Code Here

Examples of com.ning.http.client.AsyncHttpClient.prepareGet()

    public void testSuspendTimeout() {
        logger.info("running test: testSuspendTimeout");
        AsyncHttpClient c = new AsyncHttpClient();
        try {
            long t1 = System.currentTimeMillis();
            Response r = c.prepareGet(urlTarget).execute().get(10, TimeUnit.SECONDS);
            assertNotNull(r);
            assertEquals(r.getStatusCode(), 200);
            String resume = r.getResponseBody();
            assertEquals(resume, "resume");
            long current = System.currentTimeMillis() - t1;
View Full Code Here

Examples of com.ning.http.client.AsyncHttpClient.prepareGet()

        logger.info("running test: testSuspendTimeout");

        AsyncHttpClient c = new AsyncHttpClient();
        try {
            long currentTime = System.currentTimeMillis();
            Response r = c.prepareGet(urlTarget).execute().get();

            long time = System.currentTimeMillis() - currentTime;
            if (time > 5000 && time < 15000) {
                assertTrue(true);
            } else {
View Full Code Here

Examples of com.ning.http.client.AsyncHttpClient.prepareGet()

        servletLatch = new CountDownLatch(1);
        AsyncHttpClient c = new AsyncHttpClient();
        try {
            long currentTime = System.currentTimeMillis();
            final AtomicReference<Response> r = new AtomicReference();
            c.prepareGet(urlTarget).execute(new AsyncCompletionHandler<Response>() {

                @Override
                public Response onCompleted(Response response) throws Exception {
                    r.set(response);
                    latch.countDown();
View Full Code Here

Examples of com.ning.http.client.AsyncHttpClient.prepareGet()

            }
        }, new RecyclableBroadcaster("suspend"));

        AsyncHttpClient c = new AsyncHttpClient();
        try {
            Response r = c.prepareGet(urlTarget).execute().get();

            try {
                latch.await(20, TimeUnit.SECONDS);
            } catch (InterruptedException e) {
                fail(e.getMessage());
View Full Code Here

Examples of com.ning.http.client.AsyncHttpClient.prepareGet()

            }
        }, new RecyclableBroadcaster("suspend"));

        AsyncHttpClient c = new AsyncHttpClient();
        try {
            Response r = c.prepareGet(urlTarget).execute().get();

            try {
                latch.await(20, TimeUnit.SECONDS);
            } catch (InterruptedException e) {
                fail(e.getMessage());
View Full Code Here

Examples of com.ning.http.client.AsyncHttpClient.prepareGet()

            }
        }, new RecyclableBroadcaster("suspend"));

        AsyncHttpClient c = new AsyncHttpClient();
        try {
            Response r = c.prepareGet(urlTarget).execute().get();

            if (latch.getCount() != 0) {
                fail("timedout");
            }
            assertNotNull(r);
View Full Code Here

Examples of com.ning.http.client.AsyncHttpClient.prepareGet()

            }
        }, new RecyclableBroadcaster("suspend"));

        AsyncHttpClient c = new AsyncHttpClient();
        try {
            c.prepareGet(urlTarget).execute(new AsyncCompletionHandler<String>() {

                @Override
                public String onCompleted(Response response) throws Exception {
                    try {
                        assertEquals(response.getResponseBody(),
View Full Code Here

Examples of com.ning.http.client.AsyncHttpClient.prepareGet()

                    return null;
                }
            });

            suspended.await(20, TimeUnit.SECONDS);
            Response r = c.prepareGet(urlTarget).execute().get();

            try {
                latch.await(20, TimeUnit.SECONDS);
            } catch (InterruptedException e) {
                fail(e.getMessage());
View Full Code Here

Examples of com.ning.http.client.AsyncHttpClient.prepareGet()

            }
        }, new RecyclableBroadcaster("suspend"));

        AsyncHttpClient c = new AsyncHttpClient();
        try {
            c.prepareGet(urlTarget).execute(new AsyncCompletionHandler<String>() {

                @Override
                public String onCompleted(Response response) throws Exception {
                    try {
                        assertEquals(response.getResponseBody(),
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.