Package org.asynchttpclient

Examples of org.asynchttpclient.AsyncHttpClientConfig


    @Test
    public void testNoTransferEncoding() throws Exception {
        String url = "http://localhost:" + port + "/test";

        AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder()
            .setFollowRedirect(false)
            .setConnectTimeout(15000)
            .setRequestTimeout(15000)
            .setAllowPoolingConnections(false)
            .setDisableUrlEncodingForBoundRequests(true)
View Full Code Here


        String targetUrl = String.format("%s://127.0.0.1:%d/", secure ? "wss" : "ws", port2);

        // CONNECT happens over HTTP, not HTTPS
        ProxyServer ps = new ProxyServer(ProxyServer.Protocol.HTTP, "127.0.0.1", port1);
        AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder().setProxyServer(ps).setAcceptAnyCertificate(true).build();
        AsyncHttpClient asyncHttpClient = getAsyncHttpClient(config);
        try {
            final CountDownLatch latch = new CountDownLatch(1);
            final AtomicReference<String> text = new AtomicReference<String>("");
View Full Code Here

        logger.info("Local HTTP server started successfully");
    }

    @Test(groups = { "online", "default_provider" })
    public void idleStateTest() throws Exception {
        AsyncHttpClientConfig cg = new AsyncHttpClientConfig.Builder().setPooledConnectionIdleTimeout(10 * 1000).build();
        AsyncHttpClient c = getAsyncHttpClient(cg);

        try {
            c.prepareGet(getTargetUrl()).execute().get();
        } catch (ExecutionException e) {
View Full Code Here

                .setPassword("Beeblebrox");
    }

    private void ntlmAuthTest(RealmBuilder realmBuilder) throws IOException, InterruptedException, ExecutionException {

        AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder().setRealm(realmBuilder.build()).build();

        AsyncHttpClient client = getAsyncHttpClient(config);
        try {
            Request request = new RequestBuilder("GET").setUrl(getTargetUrl()).build();
            Future<Response> responseFuture = client.executeRequest(request);
View Full Code Here

     * @throws InterruptedException
     */
    @Test
    public void testRetryNonBlocking() throws IOException, InterruptedException, ExecutionException {

        AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder()//
                .setAllowPoolingConnections(true)//
                .setMaxConnections(100)//
                .setConnectTimeout(60000)//
                .setRequestTimeout(30000)//
                .build();
View Full Code Here

    }

    @Test
    public void testRetryNonBlockingAsyncConnect() throws IOException, InterruptedException, ExecutionException {

        AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder()//
                .setAllowPoolingConnections(true)//
                .setMaxConnections(100)//
                .setConnectTimeout(60000)//
                .setRequestTimeout(30000)//
                .build();
View Full Code Here

        }
    }

    @Test(groups = { "online", "default_provider" }, enabled = false)
    public void invalidStreamTest2() throws Exception {
        AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder().setRequestTimeout(10000).setFollowRedirect(true)
                .setAllowPoolingConnections(false).setMaxRedirects(6).build();

        AsyncHttpClient c = getAsyncHttpClient(config);
        try {
            Response response = c.prepareGet("http://bit.ly/aUjTtG").execute().get();
View Full Code Here

    }

    @Test(groups = { "online", "default_provider" })
    public void stripQueryStringTest() throws Exception {

        AsyncHttpClientConfig cg = new AsyncHttpClientConfig.Builder().setFollowRedirect(true).build();
        AsyncHttpClient c = getAsyncHttpClient(cg);
        try {
            Response response = c.prepareGet("http://www.freakonomics.com/?p=55846").execute().get();

            assertNotNull(response);
View Full Code Here

    }

    @Test(groups = { "online", "default_provider" })
    public void stripQueryStringNegativeTest() throws Exception {

        AsyncHttpClientConfig cg = new AsyncHttpClientConfig.Builder().setRemoveQueryParamsOnRedirect(false).setFollowRedirect(true)
                .build();
        AsyncHttpClient c = getAsyncHttpClient(cg);
        try {
            Response response = c.prepareGet("http://www.freakonomics.com/?p=55846").execute().get();
View Full Code Here

        }
    }

    @Test(groups = { "standalone", "default_provider" })
    public void multipleMaxConnectionOpenTest() throws Exception {
        AsyncHttpClientConfig cg = new AsyncHttpClientConfig.Builder().setAllowPoolingConnections(true).setConnectTimeout(5000).setMaxConnections(1).build();
        AsyncHttpClient c = getAsyncHttpClient(cg);
        try {
            String body = "hello there";

            // once
View Full Code Here

TOP

Related Classes of org.asynchttpclient.AsyncHttpClientConfig

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.