public byte[] encode(ServiceInstance<?> serviceInstance) {
        try {
            return mapper.writeValueAsBytes(requireNonNull(serviceInstance, "serviceInstance"));
        } catch (JsonProcessingException e) {
            throw new RuntimeException(
                    "Failed to encode serviceInstance. serviceInstance: " + serviceInstance, e);
        }
    }
Encodes a single {@link ServiceInstance} into a byte array representation.
zookeeper3/src/main/java/com/linecorp/armeria/internal/common/zookeeper/CuratorXNodeValueCodec.java