Android ConnPerRouteBean - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ConnPerRouteBean class.

This code example shows how to use the following methods:
        HttpConnectionParams.setSoTimeout(params, 20000);
 
        ConnManagerParams.setMaxTotalConnections(params, ConnManagerParams.DEFAULT_MAX_TOTAL_CONNECTIONS);
        ConnManagerParams.setTimeout(params, 10000);
 
        ConnPerRouteBean connPerRoute = new ConnPerRouteBean(18); // Giving 18 connections to Evernote
        ConnManagerParams.setMaxConnectionsPerRoute(params, connPerRoute);
 
        SchemeRegistry schemeRegistry = new SchemeRegistry();
        schemeRegistry.register(
            new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
 
        schemeRegistry.register(
            new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
 
        mConnectionManager = new ThreadSafeClientConnManager(params, schemeRegistry);
        DefaultHttpClient httpClient = new DefaultHttpClient(mConnectionManager, params);
        httpClient.setKeepAliveStrategy(new ConnectionKeepAliveStrategy() {
          @Override 
          public long getKeepAliveDuration(HttpResponse response,
5
CodeRank
This code example shows how to use the following methods:
 
 
 
		HttpParams params = new BasicHttpParams();
		params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 30);
		params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean(30));
		params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
		HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
 
		//ClientConnectionManager cm = new ThreadSafeClientConnManager(params, schemeRegistry); 
	         
	    SchemeRegistry registry = new SchemeRegistry();
	    registry.register(new Scheme("http", new PlainSocketFactory(), 80)); 
	    registry.register(new Scheme("https", (trustAll  ? EasySSLSocketFactory.getSocketFactory(): SSLSocketFactory.getSocketFactory()), 443));
	    DefaultHttpClient client = new DefaultHttpClient(new ThreadSafeClientConnManager(params, registry), params);
		 
	       return client;
	} 
	 
	public CaldavFacade(String mUser, String mPassword, String mURL) throws MalformedURLException  {
5
CodeRank
This code example shows how to use the following methods:
This code example shows how to use the following methods:
        schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
        schemeRegistry.register(new Scheme("https", new EasySSLSocketFactory(), 443));
  
        params = new BasicHttpParams();
        params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 1);
        params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean(1));
        params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
        HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
        HttpProtocolParams.setContentCharset(params, "utf8");
  
        CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
         
//	        credentialsProvider.setCredentials(new AuthScope("cooper.apphb.com", AuthScope.ANY_PORT) 
//	        	, new UsernamePasswordCredentials("UserNameHere", "UserPasswordHere")); 
        clientConnectionManager = new ThreadSafeClientConnManager(params, schemeRegistry);
  
        context = new BasicHttpContext();
        context.setAttribute("http.auth.credentials-provider", credentialsProvider);
	} 
	 
5
CodeRank
This code example shows how to use the following methods:
		schemeRegistry.register(new Scheme("https", new EasySSLSocketFactory(),
				4441)); 
 
		HttpParams params = new BasicHttpParams();
		params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 30);
		params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE,
				new ConnPerRouteBean(30));
		params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
		HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
		HttpProtocolParams.setContentCharset(params, "utf-8");
		ClientConnectionManager cm = new SingleClientConnManager(params,
				schemeRegistry);
		int connection_Timeout = GlobalVar.getInstance().getConnectionTimeout();
		// int connection_Timeout = 2000; 
		HttpConnectionParams.setConnectionTimeout(params, connection_Timeout);
		HttpConnectionParams.setSoTimeout(params, connection_Timeout);
		DefaultHttpClient httpClient = new DefaultHttpClient(cm, params);
		httpClient.getCredentialsProvider().setCredentials(
				new AuthScope(null, -1),
				new UsernamePasswordCredentials(user, passwd));
4
CodeRank
This code example shows how to use the following methods:
		schemeRegistry.register(new Scheme("https", new EasySSLSocketFactory(),
				443)); 
 
		params = new BasicHttpParams();
		params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 1);
		params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE,
				new ConnPerRouteBean(1));
		params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
		HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
		HttpProtocolParams.setContentCharset(params, "utf8");
		clientConnectionManager = new ThreadSafeClientConnManager(params,
				schemeRegistry);
	} 
	 
	/* 
	 * Thanks to Fabrizio Chami at JavaCodeGeeks.com 
	 * http://www.javacodegeeks.com 
	 * /2011/01/android-json-parsing-gson-tutorial.html The following method 
	 * simply takes a URL, sends a GET request to the server and returns an  
	 * input stream, which can be read and parsed. 
5
CodeRank
This code example shows how to use the following methods:
			//schemeRegistry.register(new Scheme("https", new EasySSLSocketFactory(), 8443));  
			HttpParams params = new BasicHttpParams();
			HttpConnectionParams.setConnectionTimeout(params,30 * 1000);
			HttpConnectionParams.setSoTimeout(params, 30 * 1000); 
			params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 30);
			params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean(30));
			params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
			HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
			ClientConnectionManager cm = new SingleClientConnManager(params, schemeRegistry);
			httpclient = new DefaultHttpClient(cm, params);
		HttpResponse httpResponse;
 
		httpclient.getParams().setParameter(
				CoreConnectionPNames.CONNECTION_TIMEOUT, REQUEST_MAX_TIME);
		httpclient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT,
				REQUEST_MAX_TIME);
 
		HttpPost httpRequest = new HttpPost(url);
		Log.i(TAG, "post URL = "+url);
		 
4
CodeRank
This code example shows how to use the following methods:
	    schemeRegistry.register(new Scheme("https", new EasySSLSocketFactory(), 8443));
	    schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
	     
	    HttpParams params = new BasicHttpParams();
	    params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 30);
	    params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean(30));
	    params.setParameter(ConnManagerPNames.TIMEOUT, 1000*5L);
	    params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
	     
	    HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
	     
		ClientConnectionManager connManager = new SingleClientConnManager(params, schemeRegistry);
		httpClient = new DefaultHttpClient(connManager, params);
		 
//		httpClient = new DefaultHttpClient(); 
		httpPost = new HttpPost(JSON_URL);
		Log.e(LOG_TAG, JSON_URL);
	} 
	 
	public void test(){ 
4
CodeRank
This code example shows how to use the following methods:
This code example shows how to use the following methods:
		schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
		schemeRegistry.register(new Scheme("https", new SimpleSSLSocketFactory(), 443));
 
		HttpParams params = new BasicHttpParams();
		params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 30);
		params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean(30));
		params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
		HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
 
		ClientConnectionManager cm = new SingleClientConnManager(params, schemeRegistry);
		HttpClient httpClient = new DefaultHttpClient(cm, params);
		return httpClient;
	} 
	 
	/** 
	 * Make an http request using the GET protocol 
	 * @param url 
	 * @return 
	 * @throws Exception 
	 */ 
4
CodeRank

Related Android ConnPerRouteBean Questions & Answers:

See Code Examples for Android ConnPerRouteBean Methods: