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

This code example shows how to use the following methods:
    public final HttpClient getHttpClient() {
 
        if (httpClient == null) {
            final SchemeRegistry registry = new SchemeRegistry();
            registry.register(new Scheme("http", new PlainSocketFactory(), 80));
            registry.register(new Scheme("https", new PlainSocketFactory(), 443));
 
            final HttpParams cxParams = new BasicHttpParams();
            ConnManagerParams.setMaxTotalConnections(cxParams, 5);
            HttpConnectionParams.setConnectionTimeout(cxParams, 60000);
            final ThreadSafeClientConnManager connexionManager = new ThreadSafeClientConnManager(
                    cxParams, registry);
 
            final String appVersion = VersionUtils.getCurrent(this);
            final String userAgent = String.format(
                    "ItineRennes/%s (Android/%s; SDK %s; %s; %s)", appVersion,
                    android.os.Build.VERSION.RELEASE,
                    android.os.Build.VERSION.SDK_INT, android.os.Build.MODEL,
                    android.os.Build.DEVICE);
 
Full Snippet Info
3
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
	 * @param XMLRPC 
	 *            server URI 
	 */ 
	public XMLRPCClient(URI uri) {
		SchemeRegistry registry = new SchemeRegistry();
		registry.register(new Scheme("http", new PlainSocketFactory(), 80));
		registry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
 
		postMethod = new HttpPost(uri);
		postMethod.addHeader("Content-Type", "text/xml");
 
		// WARNING 
		// I had to disable "Expect: 100-Continue" header since I had 
		// two second delay between sending http POST request and POST body 
		httpParams = postMethod.getParams();
		HttpProtocolParams.setUseExpectContinue(httpParams, false);
		this.client = new DefaultHttpClient(new ThreadSafeClientConnManager(httpParams, registry), httpParams);
	} 
 
	/** 
Full Snippet Info
3
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
      HttpConnectionParams.setConnectionTimeout(httpParams, HeurigenApp.getConfig().socketTimeout());
      HttpConnectionParams.setSoTimeout(httpParams, HeurigenApp.getConfig().socketTimeout());
      HttpConnectionParams.setSocketBufferSize(httpParams, HeurigenApp.getConfig().socketBufferSize());
 
      final SchemeRegistry registry = new SchemeRegistry();
      registry.register(new Scheme("http", new PlainSocketFactory(), RestClient.HTTP_PORT));
 
      httpClient = new DefaultHttpClient(new ThreadSafeClientConnManager(httpParams, registry), httpParams);
      localContext = new BasicHttpContext();
   } 
 
   /** 
    * Converts a Inputstream to String 
    *  
    * @author naikon 
    * @param is the inputstream which is to convert 
    * @throws IOException if an input or output exception occurred 
    * @return the converted string 
    */ 
   public String convertStreamToString(final InputStream is) throws IOException {
Full Snippet Info
3
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
				.setConnectionTimeout(httpParams, connectionTimeOut);
		HttpConnectionParams.setSoTimeout(httpParams, socketTimeOut);
		HttpConnectionParams.setSocketBufferSize(httpParams, 8192);
 
		final SchemeRegistry registry = new SchemeRegistry();
		registry.register(new Scheme("http", new PlainSocketFactory(), 80));
		registry.register(new Scheme("https", (new FakeSocketFactory()), 443));
 
		final ClientConnectionManager clientConnectionManager = new ThreadSafeClientConnManager(
				httpParams, registry);
		final DefaultHttpClient httpClient = new DefaultHttpClient(
				clientConnectionManager, httpParams);
 
		return httpClient;
	} 
 
	/** 
	 * @return Credentials to use with this HttpRequest or null if no 
	 *         credentials were supplied. 
	 */ 
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
        BasicHttpParams params = new BasicHttpParams();
        HttpConnectionParams.setConnectionTimeout(params, 45000);
        HttpConnectionParams.setSoTimeout(params, 30000);
 
        SchemeRegistry registry = new SchemeRegistry();
        registry.register(new Scheme("http", new PlainSocketFactory(), 80));
        try { 
            registry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
        } catch (Exception e) {
            Log.w(LOGTAG, "Unable to register HTTPS socket factory: " + e.getLocalizedMessage());
        } 
 
        ThreadSafeClientConnManager connManager = new ThreadSafeClientConnManager(params, registry);
        httpClient = new DefaultHttpClient(connManager, params);
    } 
 
    private static String stringFromInputStream(InputStream is) throws IOException
    { 
        char[] buf = new char[1024];
        StringBuilder out = new StringBuilder();
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android PlainSocketFactory Questions & Answers:

See Code Examples for Android PlainSocketFactory Methods: