private static void setValidHttpMethod(HttpURLConnection connection, ValidHttpMethod method)
      throws IllegalStateException {
    try {
      connection.setRequestMethod(method.name());
    } catch (ProtocolException e) {
      throw new IllegalStateException(
          String.format("failed setting %s as HTTP method", method.name()), e);
    }
  }
Creates a streaming session with the specified url

@param url the url to upload or download from
@param mode indicates if this is an upload or a download session
@throws AppleContentException
extensions/data-transfer/portability-data-transfer-apple/src/main/java/org/datatransferproject/datatransfer/apple/photos/streaming/StreamingContentClient.java