code: private HttpResponse directUpload(GenericUrl initiationRequestUrl) throws IOException {
      updateStateAndNotifyListener(UploadState.MEDIA_IN_PROGRESS);
  
      HttpContent content = mediaContent;
      if (metadata != null) {
        content = new MultipartContent().setContentParts(Arrays.asList(metadata, mediaContent));
        initiationRequestUrl.put("uploadType", "multipart");
      } else {
        initiationRequestUrl.put("uploadType", "media");
      }
      HttpRequest request =
          requestFactory.buildRequest(initiationRequestMethod, initiationRequestUrl, content);
      request.getHeaders().putAll(initiationHeaders);
      // We do not have to do anything special here if media content length is unspecified because
      // direct media upload works even when the media content length == -1.
      HttpResponse response = executeCurrentRequest(request);
      boolean responseProcessed = false;
      try {
        if (isMediaLengthKnown()) {
          totalBytesServerReceived = getMediaContentLength();
        }
        updateStateAndNotifyListener(UploadState.MEDIA_COMPLETE);
        responseProcessed = true;
      } finally {
        if (!responseProcessed) {
          response.disconnect();
        }
      }
      return response;
    }
docs: Direct Uploads the media.
  
  @param initiationRequestUrl The request URL where the initiation request will be sent
  @return HTTP response