@UnstableApi
    public InetSocketAddress toSocketAddress(int defaultPort) {
        final InetSocketAddress socketAddress = this.socketAddress;
        if (socketAddress != null) {
            return socketAddress;
        }

        final InetSocketAddress newSocketAddress = toSocketAddress0(defaultPort);
        if (hasPort()) {
            this.socketAddress = newSocketAddress;
        }
        return newSocketAddress;
    }
Converts this endpoint into an {@link InetSocketAddress}. The specified {@code defaultPort} is used
if this endpoint does not have a port number. A {@link DomainSocketAddress} is returned if this
endpoint refers to a Unix domain socket.

@see #hasPort()
@see #isDomainSocket()
core/src/main/java/com/linecorp/armeria/client/Endpoint.java