Package org.apache.http.config

Examples of org.apache.http.config.SocketConfig


        // Create a connection manager with custom configuration.
        PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(
                socketFactoryRegistry, connFactory, dnsResolver);

        // Create socket configuration
        SocketConfig socketConfig = SocketConfig.custom()
            .setTcpNoDelay(true)
            .build();
        // Configure the connection manager to use socket configuration either
        // by default or for a specific host.
        connManager.setDefaultSocketConfig(socketConfig);
View Full Code Here


        // Create a connection manager with custom configuration.
        PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(
                socketFactoryRegistry, connFactory, dnsResolver);

        // Create socket configuration
        SocketConfig socketConfig = SocketConfig.custom()
            .setTcpNoDelay(true)
            .build();
        // Configure the connection manager to use socket configuration either
        // by default or for a specific host.
        connManager.setDefaultSocketConfig(socketConfig);
View Full Code Here

        // setup an "https" server
        sslServer = (SSLServerSocket) SSLServerSocketFactory.getDefault().createServerSocket(0);
        sslServerPort = sslServer.getLocalPort();

        SocketConfig sconfig = SocketConfig.custom().setSoTimeout(100).build();
        connFactory = new BasicConnFactory(sconfig, ConnectionConfig.DEFAULT);
        pool = new BasicConnPool(connFactory);
    }
View Full Code Here

        assertEquals(100, conn.getSocketTimeout());
    }

    @Test
    public void testHttpsCreateConnection() throws Exception {
        SocketConfig sconfig = SocketConfig.custom().setSoTimeout(100).build();
        connFactory = new BasicConnFactory(
                (SSLSocketFactory)SSLSocketFactory.getDefault(),
                0, sconfig, ConnectionConfig.DEFAULT);
        host = new HttpHost("localhost", sslServerPort, "https");
        conn = connFactory.create(host);
View Full Code Here

        // setup an "https" server
        final SSLServerSocket sslServer = (SSLServerSocket) SSLServerSocketFactory.getDefault().createServerSocket(0);
        sslServerPort = sslServer.getLocalPort();

        final SocketConfig sconfig = SocketConfig.custom().setSoTimeout(100).build();
        connFactory = new BasicConnFactory(sconfig, ConnectionConfig.DEFAULT);
        pool = new BasicConnPool(connFactory);
    }
View Full Code Here

        assertEquals(100, conn.getSocketTimeout());
    }

    @Test
    public void testHttpsCreateConnection() throws Exception {
        final SocketConfig sconfig = SocketConfig.custom().setSoTimeout(100).build();
        connFactory = new BasicConnFactory(
                null,
                (SSLSocketFactory)SSLSocketFactory.getDefault(),
                0, sconfig, ConnectionConfig.DEFAULT);
        host = new HttpHost("localhost", sslServerPort, "https");
View Full Code Here

            host = route.getProxyHost();
        } else {
            host = route.getTargetHost();
        }
        final InetSocketAddress localAddress = route.getLocalSocketAddress();
        SocketConfig socketConfig = this.configData.getSocketConfig(host);
        if (socketConfig == null) {
            socketConfig = this.configData.getDefaultSocketConfig();
        }
        if (socketConfig == null) {
            socketConfig = SocketConfig.DEFAULT;
View Full Code Here

        .setConnectTimeout(20000).setStaleConnectionCheckEnabled(false)
        .build();
   
    builder.setDefaultRequestConfig(globalConfig);
   
    final SocketConfig socketConfig = SocketConfig.custom()
        .setSoTimeout(60000).setTcpNoDelay(true).build();
    builder.setDefaultSocketConfig(socketConfig);
   
    // generate httpclient
    httpClient = builder.build();
View Full Code Here

            host = route.getProxyHost();
        } else {
            host = route.getTargetHost();
        }
        final InetSocketAddress localAddress = route.getLocalSocketAddress();
        SocketConfig socketConfig = this.configData.getSocketConfig(host);
        if (socketConfig == null) {
            socketConfig = this.configData.getDefaultSocketConfig();
        }
        if (socketConfig == null) {
            socketConfig = SocketConfig.DEFAULT;
View Full Code Here

        // Create a connection manager with custom configuration.
        PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(
                socketFactoryRegistry, connFactory, dnsResolver);

        // Create socket configuration
        SocketConfig socketConfig = SocketConfig.custom()
            .setTcpNoDelay(true)
            .build();
        // Configure the connection manager to use socket configuration either
        // by default or for a specific host.
        connManager.setDefaultSocketConfig(socketConfig);
View Full Code Here

TOP

Related Classes of org.apache.http.config.SocketConfig

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.