Code example for PlainSocketFactory

0
	 * @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));