Code example for PlainSocketFactory

0
	 */ 
	public static DefaultHttpClient createStandardHttpClient(DaemonSettings settings, boolean userBasicAuth) throws DaemonException {
 
		// Register http and https sockets 
		SchemeRegistry registry = new SchemeRegistry();
		registry.register(new Scheme("http", new PlainSocketFactory(), 80));
		SocketFactory https_socket =
			  settings.getSslTrustAll() 				? new FakeSocketFactory()
			: settings.getSslTrustKey() != null			? new FakeSocketFactory(settings.getSslTrustKey())
			: SSLSocketFactory.getSocketFactory();
		registry.register(new Scheme("https", https_socket, 443)); 
		 
		// Standard parameters 
		HttpParams httpparams = new BasicHttpParams();
		HttpConnectionParams.setConnectionTimeout(httpparams, settings.getTimeoutInMilliseconds());
		HttpConnectionParams.setSoTimeout(httpparams, settings.getTimeoutInMilliseconds());
		if (userAgent != null) {
			HttpProtocolParams.setUserAgent(httpparams, userAgent);
		} 
		 
		DefaultHttpClient httpclient = new DefaultHttpClient(new ThreadSafeClientConnManager(httpparams, registry), httpparams);