code: public static String[] extractParts(String from){
      int idx     = from.lastIndexOf(":");
      String host = idx != -1 ? from.substring(0, idx)  : from;
      String port = idx != -1 ? from.substring(idx + 1) : "";
      return new String[] { host, port };
    }
docs: Splits String into host and port parts.
  String must be in ( host + ":" + port ) format.
  Port is optional
  @param from String to parse
  @return array of host and port strings