Examples of HttpParams


Examples of org.apache.http.params.HttpParams

    assertEquals(expectedPayload, payLoad);
  }

  @Test
  public void HTTP_1_0_noConnectionHeaderTest() throws ClientProtocolException, IOException {
    HttpParams params = new BasicHttpParams();
    HttpProtocolParams.setVersion(params, new ProtocolVersion("HTTP", 1, 0));
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/");
    HttpResponse response = httpclient.execute(httpget);
View Full Code Here

Examples of org.apache.http.params.HttpParams

                                         Boolean allowCircularRedirects,
                                         int connTimeout, int socketTimeout,
                                         String cookiePolicy, SSLContext sslContext,
                                         X509HostnameVerifier hostnameVerifier)
    {
        HttpParams httpParams = new BasicHttpParams();

        SchemeRegistry registry = new SchemeRegistry();

        registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
        SSLSocketFactory sslSocketFactory;
View Full Code Here

Examples of org.apache.http.params.HttpParams

  public class SingleClient implements HttpClientPool {
    SingleClient() {
      org.apache.http.client.HttpClient client = new DefaultHttpClient();
      ClientConnectionManager mgr = client.getConnectionManager();
      if (!(mgr instanceof ThreadSafeClientConnManager)) {
        HttpParams params = client.getParams();
        client = new DefaultHttpClient(new ThreadSafeClientConnManager(
            params, mgr.getSchemeRegistry()), params);
      }

      // Use Proxy to access if you are in one of the countries that cannot connects to twitter directly.  
View Full Code Here

Examples of org.apache.http.params.HttpParams

   }


   private ApacheHttpClient4Executor createClient()
   {
      HttpParams params = new BasicHttpParams();
      ConnManagerParams.setMaxTotalConnections(params, 3);
      ConnManagerParams.setTimeout(params, 1000);

      // Create and initialize scheme registry
      SchemeRegistry schemeRegistry = new SchemeRegistry();
View Full Code Here

Examples of org.apache.http.params.HttpParams

    schemeRegistry.register(new Scheme("https", 443, getSSLSocketFactory()));

    final ThreadSafeClientConnManager clientConnectionManager = new ThreadSafeClientConnManager(schemeRegistry);

    // Create and initialize HTTP parameters
    final HttpParams httpParams = new BasicHttpParams();
    /**
     * ConnectionManager settings
     */
    // how much connections do we need? - default: 20
    clientConnectionManager.setMaxTotal(maxcon);
View Full Code Here

Examples of org.apache.http.params.HttpParams

        }
       
        DefaultHttpAsyncClient dhac = new DefaultHttpAsyncClient(connectionManager) {
            @Override
            protected HttpParams createHttpParams() {
                HttpParams params = new SyncBasicHttpParams();
                HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
                HttpConnectionParams.setTcpNoDelay(params, true);
                int bufSize = c.getClient().getChunkLength() > 0 ? c.getClient().getChunkLength() : 16332;
                HttpConnectionParams.setSocketBufferSize(params, bufSize);
                HttpConnectionParams.setConnectionTimeout(params, (int)c.getClient().getConnectionTimeout());
View Full Code Here

Examples of org.apache.http.params.HttpParams

    }


    public void testCloseExpiredConnections() throws Exception {

        HttpParams mgrpar = defaultParams.copy();
        ConnManagerParams.setMaxTotalConnections(mgrpar, 1);

        ThreadSafeClientConnManager mgr = createTSCCM(mgrpar, null);

        final HttpHost target = getServerHttp();
View Full Code Here

Examples of org.apache.http.params.HttpParams

     * Tests releasing connection from #abort method called from the
     * main execution thread while there is no blocking I/O operation.
     */
    public void testReleaseConnectionOnAbort() throws Exception {

        HttpParams mgrpar = defaultParams.copy();
        ConnManagerParams.setMaxTotalConnections(mgrpar, 1);

        ThreadSafeClientConnManager mgr = createTSCCM(mgrpar, null);

        final HttpHost target = getServerHttp();
View Full Code Here

Examples of org.apache.http.params.HttpParams

     * Tests GC of an unreferenced connection.
     */
    public void testConnectionGC() throws Exception {
        // 3.x: TestHttpConnectionManager.testReclaimUnusedConnection

        HttpParams mgrpar = defaultParams.copy();
        ConnManagerParams.setMaxTotalConnections(mgrpar, 1);

        ThreadSafeClientConnManager mgr = createTSCCM(mgrpar, null);

        final HttpHost target = getServerHttp();
View Full Code Here

Examples of org.apache.http.params.HttpParams

        assertNull("TSCCM not garbage collected", wref.get());
    }
   
    public void testAbortDuringConnecting() throws Exception {
        HttpParams mgrpar = defaultParams.copy();
        ConnManagerParams.setMaxTotalConnections(mgrpar, 1);
       
        final CountDownLatch connectLatch = new CountDownLatch(1);       
        final StallingSocketFactory stallingSocketFactory = new StallingSocketFactory(connectLatch, WaitPolicy.BEFORE_CONNECT, PlainSocketFactory.getSocketFactory());
        Scheme scheme = new Scheme("http", stallingSocketFactory, 80);
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.