Code example for UsernamePasswordCredentials

0
		} 
 
	} 
 
	public void setCriedentials(String username, String password) {
		httpclient.getCredentialsProvider().setCredentials(
				new AuthScope("build.phonegap.com", 443),
				new UsernamePasswordCredentials(username, password));
 
	} 
 
	public boolean TryAuthenticate() throws ClientProtocolException, 
			IOException { 
		HttpGet httpget = new HttpGet("https://build.phonegap.com/api/v1/me");
		HttpResponse response = httpclient.execute(httpget);
 
		if (response == null) {
			throw new ConnectException("Could not connect to the server");
		} 
		if (response.getStatusLine().getStatusCode() == 401) {
			System.out.println(getJsonFromResponse(response).getAsJsonObject()