Code example for HttpResponseException

0
	public byte[] handleResponse(final HttpResponse response)
									throws IOException, HttpResponseException { 
		StatusLine statusLine = response.getStatusLine();
		 
		if (statusLine.getStatusCode()>=300) {
			throw new HttpResponseException(statusLine.getStatusCode(),
											statusLine.getReasonPhrase());
		} 
 
		HttpEntity entity=response.getEntity();
		 
		if (entity==null) {
			return(null); 
		} 
		 
		return(EntityUtils.toByteArray(entity));
	} 
} 
Connect your IDE to all the code out there  Get Codota for Java