Code example for PlainSocketFactory

0
	private static DefaultHttpClient httpClient = null;
	 
	private static void ensureClient() { 
		if (httpClient == null) {
			SchemeRegistry registry = new SchemeRegistry();
			registry.register(new Scheme("http", new PlainSocketFactory(), 80));
			HttpParams httpparams = new BasicHttpParams();
			HttpConnectionParams.setConnectionTimeout(httpparams, TIMEOUT);
			HttpConnectionParams.setSoTimeout(httpparams, TIMEOUT);
			HttpProtocolParams.setUserAgent(httpparams, USER_AGENT);
			 
			httpClient = new DefaultHttpClient(new ThreadSafeClientConnManager(httpparams, registry), httpparams);
			// TODO: See if we can enable this again; RateBeer seemd to have problems with sending GZipped content 
			//httpClient.addRequestInterceptor(HttpHelper.gzipRequestInterceptor); 
			//httpClient.addResponseInterceptor(HttpHelper.gzipResponseInterceptor); 
		} 
	} 
 
	public static String makeRBGet(String url) throws ClientProtocolException, IOException {
		return getResponseString(makeRawRBGet(url));
	}