code: public static Optional<String> getProtocol(final String aUrl) {
      if (aUrl != null) {
        int index = aUrl.indexOf("//");
        if (index > 0) {
          String protocol = aUrl.substring(0, index);
          return Optional.of(protocol);
        }
      }
  
      return Optional.empty();
    }
docs: returns the protocol of the url.
  
  @param aUrl the url
  @return the protocol of the url (e.g. "http:")