public byte[] encode(Endpoint endpoint) {
        requireNonNull(endpoint, "endpoint");
        final String endpointStr;
        if (endpoint.hasPort()) {
            endpointStr = endpoint.host() + fieldDelimiter + endpoint.port() +
                          fieldDelimiter + endpoint.weight();
        } else {
            endpointStr = endpoint.host();
        }
        return endpointStr.getBytes(StandardCharsets.UTF_8);
    }
Encodes a single {@link Endpoint} into a byte array representation.
zookeeper3/src/main/java/com/linecorp/armeria/internal/common/zookeeper/LegacyNodeValueCodec.java