public Endpoint decode(byte[] znodeValue) {
        requireNonNull(znodeValue, "znodeValue");
        final String segment = new String(znodeValue, StandardCharsets.UTF_8);
        final String[] tokens = segment.split(fieldDelimiter);
        final Endpoint endpoint;
        switch (tokens.length) {
            case 1: //host
                endpoint = Endpoint.of(segment);
                break;
            case 2: { //host and port
                final String host = tokens[0];
                final int port = Integer.parseInt(tokens[1]);
                if (port == 0) {
                    endpoint = Endpoint.of(host);
                } else {
                    endpoint = Endpoint.of(host, port);
                }
                break;
            }
            case 3: { //host , port , weight
                final String host = tokens[0];
                final int port = Integer.parseInt(tokens[1]);
                final int weight = Integer.parseInt(tokens[2]);
                if (port == 0) {
                    endpoint = Endpoint.of(host).withWeight(weight);
                } else {
                    endpoint = Endpoint.of(host, port).withWeight(weight);
                }
                break;
            }
            default: //unknown
                throw new EndpointGroupException("invalid endpoint segment: " + segment);
        }
        return endpoint;
    }
Decodes a znode value to an {@link Endpoint}.
zookeeper3/src/main/java/com/linecorp/armeria/internal/common/zookeeper/LegacyNodeValueCodec.java