Package org.asynchttpclient

Examples of org.asynchttpclient.AsyncHttpClientConfig


     * Tests that after a redirect the final url in the response reflect the redirect
     */
    @Test
    public void testGetRedirectFinalUrl() throws Exception {

        AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder()//
                .setAllowPoolingConnections(true)//
                .setMaxConnectionsPerHost(1)//
                .setMaxConnections(1)//
                .setConnectTimeout(1000)//
                .setRequestTimeout(1000)//
View Full Code Here


    // @Test(groups = { "standalone", "default_provider" })
    public void httpToHttpsRedirect() throws Exception {
        redirectDone.getAndSet(false);

        AsyncHttpClientConfig cg = new AsyncHttpClientConfig.Builder()//
                .setMaxRedirects(5)//
                .setFollowRedirect(true)//
                .setAcceptAnyCertificate(true)//
                .build();
        AsyncHttpClient c = getAsyncHttpClient(cg);
View Full Code Here

    // @Test(groups = { "standalone", "default_provider" })
    public void httpToHttpsProperConfig() throws Exception {
        redirectDone.getAndSet(false);

        AsyncHttpClientConfig cg = new AsyncHttpClientConfig.Builder()//
                .setMaxRedirects(5)//
                .setFollowRedirect(true)//
                .setAcceptAnyCertificate(true)//
                .build();
        AsyncHttpClient c = getAsyncHttpClient(cg);
View Full Code Here

    // @Test(groups = { "standalone", "default_provider" })
    public void relativeLocationUrl() throws Exception {
        redirectDone.getAndSet(false);

        AsyncHttpClientConfig cg = new AsyncHttpClientConfig.Builder()//
                .setMaxRedirects(5)//
                .setFollowRedirect(true)//
                .setAcceptAnyCertificate(true)//
                .build();
        AsyncHttpClient c = getAsyncHttpClient(cg);
View Full Code Here

    @Test(groups = { "online", "default_provider" })
    public void testRequestProxy() throws IOException, InterruptedException, ExecutionException, TimeoutException {

        ProxyServer ps = new ProxyServer(ProxyServer.Protocol.HTTPS, "127.0.0.1", port1);

        AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder()//
        .setFollowRedirect(true)//
        .setAcceptAnyCertificate(true)//
        .build();

        AsyncHttpClient asyncHttpClient = getAsyncHttpClient(config);
View Full Code Here

        }
    }

    @Test(groups = { "online", "default_provider" })
    public void testConfigProxy() throws IOException, InterruptedException, ExecutionException, TimeoutException {
        AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder()//
                .setFollowRedirect(true)//
                .setProxyServer(new ProxyServer(ProxyServer.Protocol.HTTPS, "127.0.0.1", port1))//
                .setAcceptAnyCertificate(true)//
                .build();
        AsyncHttpClient asyncHttpClient = getAsyncHttpClient(config);
View Full Code Here

            final ConnectionPool connectionPool,//
            final FilterChainBuilder secureBuilder,//
            final FilterChainBuilder nonSecureBuilder) {

        this.provider = provider;
        final AsyncHttpClientConfig config = provider.getClientConfig();
        if (connectionPool != null) {
            this.connectionPool = connectionPool;
            canDestroyPool = false;
        } else {
            this.connectionPool = new ConnectionPool(config.getMaxConnectionsPerHost(),//
                    config.getMaxConnections(),//
                    null,//
                    config.getConnectTimeout(),//
                    config.getPooledConnectionIdleTimeout(),//
                    2000);
            canDestroyPool = true;
        }
        this.secureBuilder = secureBuilder;
        this.nonSecureBuilder = nonSecureBuilder;
        AsyncHttpProviderConfig<?, ?> providerConfig = config.getAsyncHttpProviderConfig();
        asyncConnect = providerConfig instanceof GrizzlyAsyncHttpProviderConfig ? GrizzlyAsyncHttpProviderConfig.class.cast(providerConfig)
                .isAsyncConnectMode() : false;
    }
View Full Code Here

        final CountDownLatch latch = new CountDownLatch(threadCount);
        final int port = (secure ? SECURE_PORT : NON_SECURE_PORT);
        final String scheme = (secure ? "https" : "http");
        ExecutorService service = Executors.newFixedThreadPool(threadCount);

        AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder().setMaxConnectionsPerHost(60).setMaxConnections(60).setAcceptAnyCertificate(true).build();
        final AsyncHttpClient client = new DefaultAsyncHttpClient(new GrizzlyAsyncHttpProvider(config), config);
        try {
            final int[] statusCodes = new int[threadCount];
            final int[] totalsReceived = new int[threadCount];
            final Throwable[] errors = new Throwable[threadCount];
View Full Code Here

        final CountDownLatch latch = new CountDownLatch(threadCount);
        final int port = (secure ? SECURE_PORT : NON_SECURE_PORT);
        final String scheme = (secure ? "https" : "http");
        final ExecutorService service = Executors.newCachedThreadPool();

        AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder().setMaxConnectionsPerHost(60).setMaxConnections(60).setAcceptAnyCertificate(true).build();
        final AsyncHttpClient client = new DefaultAsyncHttpClient(new GrizzlyAsyncHttpProvider(config), config);
        try {
            final int[] statusCodes = new int[threadCount];
            final int[] totalsReceived = new int[threadCount];
            final Throwable[] errors = new Throwable[threadCount];
View Full Code Here

    }

    @Override
    @Test
    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";
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.