code: public HostAddress withDefaultPort(int defaultPort)
      {
          if (!isValidPort(defaultPort)) {
              throw new IllegalArgumentException("Port number out of range: " + defaultPort);
          }
  
          if (hasPort() || port == defaultPort) {
              return this;
          }
          return new HostAddress(host, defaultPort);
      }
docs: Provide a default port if the parsed string contained only a host.
  <p>
  You can chain this after {@link #fromString(String)} to include a port in
  case the port was omitted from the input string.  If a port was already
  provided, then this method is a no-op.
  
  @param defaultPort a port number, from [0..65535]
  @return a HostAddress instance, guaranteed to have a defined port.