Package com.ning.http.client

Examples of com.ning.http.client.Response


                latch.await(20, TimeUnit.SECONDS);
            } catch (InterruptedException e) {
                fail(e.getMessage());
            }

            Response r = response.get();
            assertNotNull(r);
            assertEquals(r.getStatusCode(), 200);
            assertEquals(r.getResponseBody().trim(), "&lt;script&gt;foo&lt;/script&gt;<br />");
        } catch (Exception e) {
            logger.error("test failed", e);
            fail(e.getMessage());
        }
View Full Code Here


                latch.await(20, TimeUnit.SECONDS);
            } catch (InterruptedException e) {
                fail(e.getMessage());
            }

            Response r = response.get();
            assertNotNull(r);
            assertEquals(r.getStatusCode(), 200);
            assertEquals(r.getResponseBody(), "==================================================\n" +
                    "==================================================\n" +
                    "==================================================\n" +
                    "==================================================\n" +
                    "==================================================\n" +
                    "==================================================\n");
View Full Code Here

                }
            });

            // Let Atmosphere suspend the connections.
            Thread.sleep(2500);
            Response r = c.preparePost(urlTarget + "/programmaticDelayBroadcast").addParameter("message", "foo").execute().get();
            assertEquals(r.getStatusCode(), 200);
            r = c.preparePost(urlTarget + "/publishAndResume").addParameter("message", "bar").execute().get();
            assertEquals(r.getStatusCode(), 200);

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

            r = response.get();

            assertNotNull(r);
            assertEquals("foobar", r.getResponseBody().trim());
            assertEquals(r.getStatusCode(), 200);
        } catch (Exception e) {
            logger.error("test failed", e);
            fail(e.getMessage());
        }
        c.close();
View Full Code Here

        assertNotNull(server);
        server.start();

        AsyncHttpClient c = new AsyncHttpClient();
        Response r = c.prepareGet(targetUrl + "/suspend").execute().get();

        assertEquals(r.getStatusCode(), 200);
        assertEquals(b.get(), true);

    }
View Full Code Here

            }
        });

        suspendCD.await(5, TimeUnit.SECONDS);

        Response r = c.prepareGet(targetUrl + "/suspend").execute().get();
        assertEquals(r.getStatusCode(), 200);

        l.await(5, TimeUnit.SECONDS);

        assertEquals(response.get().getStatusCode(), 200);
        assertEquals(response.get().getResponseBody().trim(), RESUME);
View Full Code Here

            }
        });

        suspendCD.await(5, TimeUnit.SECONDS);

        Response r = c.prepareGet(targetUrl + "/suspend").execute().get();
        assertEquals(r.getStatusCode(), 200);

        l.await(5, TimeUnit.SECONDS);

        assertEquals(response.get().getStatusCode(), 200);
        assertEquals(response.get().getResponseBody().trim(), RESUME);
View Full Code Here

        server = new Nettosphere.Builder().config(config).build();
        assertNotNull(server);
        server.start();

        AsyncHttpClient c = new AsyncHttpClient();
        Response response = c.prepareGet(targetUrl).execute().get();
        assertNotNull(response);

        assertEquals(response.getResponseBody(), "Hello World from Nettosphere");

    }
View Full Code Here

                    sslEngine.setUseClientMode(true);
                    sslEngine.setEnabledCipherSuites(new String[]{"SSL_DH_anon_WITH_RC4_128_MD5"});
                    return sslEngine;
            }
        }).build());
        Response response = c.prepareGet("https://127.0.0.1:" + port).execute().get();
        assertNotNull(response);

        assertEquals(response.getResponseBody(), "Hello World from Nettosphere");

    }
View Full Code Here

            }
        });

        suspendCD.await(5, TimeUnit.SECONDS);

        Response r = c.prepareGet(targetUrl + "/suspend").execute().get();
        assertEquals(r.getStatusCode(), 200);

        l.await(5, TimeUnit.SECONDS);

        assertEquals(response.get().getStatusCode(), 200);
        assertEquals(response.get().getResponseBody().trim(), RESUME);
View Full Code Here

        for (int i=0; i < 10000; i++) {
            b.append("======");
        }
        b.append("message");

        Response r = c.preparePost(targetUrl + "/suspend").setContentLength(b.toString().length()).setBody(b.toString()).execute().get();
        assertEquals(r.getStatusCode(), 200);

        l.await(5, TimeUnit.SECONDS);

        assertEquals(response.get().getStatusCode(), 200);
        assertEquals(response.get().getResponseBody().trim(), b.toString());
View Full Code Here

TOP

Related Classes of com.ning.http.client.Response

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.