code: public static SocketAddress newSocketAddress(String host, int port) {
      return Optional.ofNullable(host).map(hostname -> new InetSocketAddress(host, port))
        .orElseGet(() -> new InetSocketAddress(port));
    }
docs: Constructs a new instance of {@link SocketAddress} bound to the given {@link String host} and {@link Integer port}.
  
  @param host {@link String} containing the name of the host to whichthe {@link SocketAddress} will be bound.
  @param port {@link Integer} specifying the port number to which the {@link SocketAddress} will be bound.
  @return a new instance of {@link SocketAddress} bound to the given {@link Integer port}.
  @throws IllegalArgumentException if the port parameter is outside the range of valid port values.
  @see #newSocketAddress(String, int)
  @see java.net.InetSocketAddress
  @see java.net.SocketAddress