code: public static byte[] serializeServiceInstance(
        ServiceInstance serviceInstance, Codec<ServiceInstance> codec) throws IOException {
  
      ByteArrayOutputStream output = new ByteArrayOutputStream();
      codec.serialize(serviceInstance, output);
      return output.toByteArray();
    }
docs: Returns a serialized Thrift service instance object, with given endpoints and codec.
  
  @param serviceInstance the Thrift service instance object to be serialized
  @param codec the codec to use to serialize a Thrift service instance object
  @return byte array that contains a serialized Thrift service instance