Examples of prepareGet()


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

        final CountDownLatch latch = new CountDownLatch(1);
        long t1 = System.currentTimeMillis();
        AsyncHttpClient c = new AsyncHttpClient();
        try {
            final AtomicReference<Response> response = new AtomicReference<Response>();
            c.prepareGet(urlTarget + "/foreverWithoutComments").execute(new AsyncCompletionHandler<Response>() {

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

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

        final CountDownLatch latch = new CountDownLatch(1);
        long t1 = System.currentTimeMillis();
        AsyncHttpClient c = new AsyncHttpClient();
        try {
            final AtomicReference<Response> response = new AtomicReference<Response>();
            c.prepareGet(urlTarget + "/foreverWithoutComments").execute(new AsyncCompletionHandler<Response>() {

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

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

            // Broadcast
            c.preparePost(urlTarget).addParameter("message", "cachememe").execute().get();

            //Suspend
            Response r = c.prepareGet(urlTarget + "/subscribeAndResume").addHeader("X-Cache-Date", String.valueOf(t1)).execute(new AsyncCompletionHandler<Response>() {

                @Override
                public Response onCompleted(Response r) throws Exception {
                    try {
                        return r;
View Full Code Here

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

        final CountDownLatch latch = new CountDownLatch(1);
        AsyncHttpClient c = new AsyncHttpClient();
        try {
            final AtomicReference<Response> response = new AtomicReference<Response>();
            c.prepareGet(urlTarget + "/forever").execute(new AsyncCompletionHandler<Response>() {

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

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

        logger.info("Running 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()

        AsyncHttpClient c = new AsyncHttpClient();
        urlTarget = "http://127.0.0.1:" + port + "/builder/invoke/204";
        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();
            long current = System.currentTimeMillis() - t1;
            assertTrue(current > 5000 && current < 10000);
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

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 {
            Future<Response> f = c.prepareGet(urlTarget).execute();

            latch.await(5, TimeUnit.SECONDS);

            c.prepareGet(urlTarget).execute().get();
            c.prepareGet(urlTarget).execute().get();
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.