@Override
  public ResponseMessage deserializeResponse(final ByteBuf msg) throws SerializationException {
    try {
      final Kryo kryo = kryoThreadLocal.get();
      final byte[] payload = new byte[msg.readableBytes()];
      msg.readBytes(payload);
      try (final Input input = new Input(payload)) {
        final UUID requestId = kryo.readObjectOrNull(input, UUID.class);
        final int status = input.readShort();
        final String statusMsg = input.readString();
        final Map<String, Object> statusAttributes =
            (Map<String, Object>) kryo.readClassAndObject(input);
        final Object result = kryo.readClassAndObject(input);
        final Map<String, Object> metaAttributes =
            (Map<String, Object>) kryo.readClassAndObject(input);

        return ResponseMessage.build(requestId)
            .code(ResponseStatusCode.getFromValue(status))
            .statusMessage(statusMsg.intern())
            .statusAttributes(statusAttributes)
            .result(result)
            .responseMetaData(metaAttributes)
            .create();
      }
    } catch (Exception ex) {
      logger.warn(
          "Response [{}] could not be deserialized by {}.",
          msg,
          GryoMessageSerializerV1d0.class.getName());
      throw new SerializationException(ex);
    }
  }
  @Override
  public RequestMessage deserializeRequest(final ByteBuf msg) throws SerializationException {
    try {
      final Kryo kryo = kryoThreadLocal.get();
      final byte[] payload = new byte[msg.readableBytes()];
      msg.readBytes(payload);
      try (final Input input = new Input(payload)) {
        // by the time the message gets here, the mime length/type have been already read, so this
        // part just
        // needs to process the payload.
        final UUID id = kryo.readObject(input, UUID.class);
        final String processor = input.readString();
        final String op = input.readString();

        final RequestMessage.Builder builder =
            RequestMessage.build(op).overrideRequestId(id).processor(processor);

        final Map<String, Object> args = kryo.readObject(input, HashMap.class);
        args.forEach(builder::addArg);
        return builder.create();
      }
    } catch (Exception ex) {
      logger.warn(
          "Request [{}] could not be deserialized by {}.",
          msg,
          GryoMessageSerializerV1d0.class.getName());
      throw new SerializationException(ex);
    }
  }
    @Override
    public TinkerGraph read(
        final Kryo kryo, final Input input, final Class<TinkerGraph> tinkerGraphClass) {
      final TinkerGraph graph = TinkerGraph.open();
      final int len = input.readInt();
      final byte[] bytes = input.readBytes(len);
      try (final ByteArrayInputStream stream = new ByteArrayInputStream(bytes)) {
        GryoReader.build().mapper(() -> kryo).create().readGraph(stream, graph);
      } catch (Exception io) {
        throw new RuntimeException(io);
      }

      return graph;
    }