public static boolean hasPort(String url){
  return !Strings.isNullOrEmpty(url) && url.split(":").length > 2;
}

public static boolean hasPort ( String url ) { return ! Strings . isNullOrEmpty ( url ) && url . split ( ":" ) . length > 2 ; }
validates if the url contains a port section " path : port " .
