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
Experience pair programming with AI  Get Codota for Java
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
Experience pair programming with AI  Get Codota for Java
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
Experience pair programming with AI  Get Codota for Java
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
Experience pair programming with AI  Get Codota for Java
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
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
		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  {
		url = new URL(mURL);
		 
		httpClient = getHttpClient();
		 
	    UsernamePasswordCredentials upc = new UsernamePasswordCredentials(mUser, mPassword);
		 
	   AuthScope as = new AuthScope(url.getHost(), -1);
Full Snippet Info
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	 * @throws DaemonException On conflicting or missing settings 
	 */ 
	private DefaultHttpClient initialise() {
 
		SchemeRegistry registry = new SchemeRegistry();
		registry.register(new Scheme("http", new PlainSocketFactory(), 80));
		registry.register(new Scheme("https", new FakeSocketFactory(), 443)); 
		 
		HttpParams httpparams = new BasicHttpParams();
		HttpConnectionParams.setConnectionTimeout(httpparams, 5000);
		HttpConnectionParams.setSoTimeout(httpparams, 5000); 
		DefaultHttpClient httpclient = new DefaultHttpClient(new ThreadSafeClientConnManager(httpparams, registry), httpparams);
 
		return httpclient;
		 
	} 
	 
    /** 
     * By default creates a standard Item (with title, description and links), which 
     * may to overriden to add more data. 
Full Snippet Info
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	DefaultHttpClient httpclient;
	String baseURL;
 
	public Fetcher(String baseURL) {
	    SchemeRegistry registry = new SchemeRegistry();
	    registry.register(new Scheme("http", new PlainSocketFactory(), 80));
	    registry.register(new Scheme("https", new FakeSocketFactory(), 443));
        HttpParams httpparams = new BasicHttpParams();
	    httpclient = new DefaultHttpClient(new ThreadSafeClientConnManager(httpparams, registry), httpparams);
 
	    if (!baseURL.endsWith("/")) baseURL += "/";
	    this.baseURL = baseURL;
	} 
 
	public String doLogin(String username, String password) {
	    HttpPost httpost = new HttpPost(baseURL + "login");
 
	    try { 
		    httpost.setEntity(new StringEntity("{\"user\":{\"login\":\"" + username + "\",\"password\":\"" + password + "\"}}"));
		    httpost.setHeader("Content-Type", "application/json");
Full Snippet Info
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	 * @param params 
	 * @return 
	 */ 
	private ClientConnectionManager getConManager (HttpParams params) {
		SchemeRegistry registry = new SchemeRegistry();
	    registry.register(new Scheme("http", new PlainSocketFactory(), 80));
	    registry.register(new Scheme("https", (trustAllSSLCerts ? new TrustAllSocketFactory() : SSLSocketFactory.getSocketFactory()), 443));
		return new ThreadSafeClientConnManager(params, registry);
	} 
	 
	/** 
	 * Create a DefaultHttpClient instance preconfigured with username and password 
	 * @param user 
	 * @param pass 
	 * @return 
	 */ 
	private DefaultHttpClient prepareHttpClient(String user, String pass) {
		BasicCredentialsProvider credProvider = new BasicCredentialsProvider();
		credProvider.setCredentials(AuthScope.ANY,
				new UsernamePasswordCredentials(user, pass));		
Full Snippet Info
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: createSocket
    public Socket createSocket(final HttpParams params) {
        final HttpHost socksProxy = getSocksProxy(params);
        if (socksProxy != null) {
            return createSocketWithSocksProxy(socksProxy);
        } 
        return super.createSocket(params);
    } 
} 
Full Snippet Info
4
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Android PlainSocketFactory Questions & Answers:

See Code Examples for Android PlainSocketFactory Methods: