code: public static HttpUrl parse(String url) {
          Builder builder = new Builder();
          Builder.ParseResult result = builder.parse(null, url);
          return result == Builder.ParseResult.SUCCESS ? builder.build() : null;
      }
docs: Returns a new {@code HttpUrl} representing {@code url} if it is a well-formed HTTP or HTTPS
  URL, or null if it isn't.