Android SingleClientConnManager - 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 SingleClientConnManager class.

This code example shows how to use the following methods:
			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);
		 
		InputStreamBody isb = new InputStreamBody(is, filename);
        MultipartEntity multipartEntity = new MultipartEntity();
        multipartEntity.addPart("uid", new StringBody(bundle.get("uid").toString())); 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
    schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), HTTP_PORT_DEFAULT));
    schemeRegistry.register(new Scheme("https", m_sslSocketFactory, HTTPS_PORT_DEFAULT));
    if (threadSafe) {
      return new ThreadSafeClientConnManager(sm_httpParams, schemeRegistry);
    } else { 
      return new SingleClientConnManager(sm_httpParams, schemeRegistry);
    } 
  } 
 
  private static SocketFactory createSocketFactory(boolean allowInvalidCerts) {
    SocketFactory sslSocketFactory;
    if (allowInvalidCerts) {
      sslSocketFactory = new WeaveSSLSocketFactory();
    } else { 
      sslSocketFactory = SSLSocketFactory.getSocketFactory();
      ((SSLSocketFactory)sslSocketFactory).setHostnameVerifier(new WeaveHostnameVerifier());
    } 
    return sslSocketFactory;
  } 
 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
This code example shows how to use the following methods:
		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));
 
		try { 
			httpClient.execute(request);
		} catch (ClientProtocolException e) {
			Log.d("Barcode", "clientprot");
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	    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(){ 
		try { 
			HttpGet httpGet = new HttpGet("http://1.1.1.1");
			HttpResponse response = httpClient.execute(httpGet);
			String value = "--";
			if (httpGet.getFirstHeader("location") != null ) {
				value = httpGet.getFirstHeader("location").getValue();
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
		SchemeRegistry schemeRegistry = new SchemeRegistry();
		schemeRegistry.register(new Scheme("http",
		  PlainSocketFactory.getSocketFactory(), 80));
 
		SingleClientConnManager cm =
		  new SingleClientConnManager(params, schemeRegistry);
 
		return new DefaultHttpClient(cm, params);
	} 
 
	public void run() 
	{ 
		Log.d(TAG, "Connecting...");
 
		HttpClient cli = getClient();
		HttpGet method;
		 
		method = new HttpGet(mDownload.url.toString());
		 
		/* It's important that we pause here to check if we've been stopped 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
         
        HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1);
        HttpProtocolParams.setUseExpectContinue(httpParams, false);
         
//        ThreadSafeClientConnManager  connectionManager = new ThreadSafeClientConnManager(httpParams,supportedSchemes); 
        SingleClientConnManager singleClientConnManager=new SingleClientConnManager(httpParams,supportedSchemes);
        HttpConnectionParams.setConnectionTimeout(httpParams, conTimeOutMs);
        HttpConnectionParams.setSoTimeout(httpParams, soTimeOutMs);
         
        HttpClientParams.setCookiePolicy(httpParams, CookiePolicy.BROWSER_COMPATIBILITY);
//        httpClient=new DefaultHttpClient(connectionManager, httpParams); 
        httpClient=new DefaultHttpClient(singleClientConnManager, httpParams);
    } 
 
    /** 
     * Get方法传送消息 
     *  
     * @param url  连接的URL 
     * @param queryString  请求参数串 
     * @return 服务器返回的信息 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
                SchemeRegistry schemeRegistry = new SchemeRegistry();
                schemeRegistry.register(new Scheme("http",
                  PlainSocketFactory.getSocketFactory(), 80));
 
                SingleClientConnManager cm =
                  new SingleClientConnManager(params, schemeRegistry);
 
                return new DefaultHttpClient(cm, params);
        } 
 
        public void run() 
        { 
                Log.d(TAG, "Connecting...");
 
                HttpClient cli = getClient();
                HttpGet method;
                 
                method = new HttpGet(mDownload.url.toString());
                 
                /* It's important that we pause here to check if we've been stopped 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
		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 
	 */ 
	public static String getUrl(String url) throws Exception {
		HttpClient httpClient = getHttpClient();
		HttpGet httpRequest = new HttpGet(url);
		return execHttpRequest(httpClient, httpRequest);
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:

Related Android SingleClientConnManager Questions & Answers:

See Code Examples for Android SingleClientConnManager Methods: