Code example for AuthScope

		httpClient = new DefaultHttpClient(cm, params);
		// authentication 
		if (user != null && passwd != null) {
	                new AuthScope(hostname, port),
	                new UsernamePasswordCredentials(user, passwd));
	public HttpClient getHttpClient() {
		return httpClient;
	protected JSONObject doJSONRequest(JSONObject jsonRequest) throws JSONRPCException
		// Create HTTP/POST request with a JSON entity containing the request 
		HttpPost request = new HttpPost("http://"+hostname+":"+port+"/jsonrpc");
Contextual code suggestions in your IDE  Get Codota for Java