code: private <T> HttpResponse sendRequest(final URI uri, final HttpRequest<T> request) throws IOException, ProtocolException
  	{
  		final HttpURLConnection connection;
  		try
  		{
  			connection = mConnectionFactory.httpUrlConnection(uri);
  		}
  		catch (IllegalArgumentException e)
  		{
  			throw new ProtocolException("The given URI is not applicable to HTTP requests.", e);
  		}
  		// ensure the expected redirect behavior
  		connection.setInstanceFollowRedirects(false);
  		// set the request method
  		connection.setDoOutput(request.method().supportsRequestPayload());
  		connection.setRequestMethod(request.method().verb());
  		// add all headers
  		for (Header<?> header : request.headers())
  		{
  			connection.setRequestProperty(header.type().name(), header.toString());
  		}
  		// also set the content-type header if we have any content-type
  		if (request.requestEntity().contentType() != null)
  		{
  			connection.setRequestProperty(HttpHeaders.CONTENT_TYPE.name(), HttpHeaders.CONTENT_TYPE.valueString(request.requestEntity().contentType()));
  		}
  		// send the request entity if applicable
  		if (request.method().supportsRequestPayload())
  		{
  			OutputStream out = connection.getOutputStream();
  			try
  			{
  				request.requestEntity().writeContent(out);
  			}
  			finally
  			{
  				out.close();
  			}
  		}
  		// return the response
  		return new HttpUrlConnectionResponse(uri, connection);
  	}
docs: Sends the request and returns an {@link HttpResponse}.
  
  @param uri
  The URL to connect to.
  @param request
  The {@link HttpRequest} to send.
  @return An {@link HttpResponse}.
  @throws MalformedURLException
  @throws IOException
  @throws ProtocolException