protected List<ByteBuffer> prepareResponse(Object value, int rmtVersion,
                RPCProtos.ResponseHeader.Status status,
                String errorClass, String error) {
            ByteBufferOutputStream buf = new ByteBufferOutputStream();
            DataOutputStream out = new DataOutputStream(buf);
            errorClass = MixUtils.replaceClassNamePrefix(errorClass, true, rmtVersion);
            try {
                RPCProtos.RpcConnHeader.Builder connBuilder =
                        RPCProtos.RpcConnHeader.newBuilder();
                connBuilder.setFlag(RpcConstants.RPC_FLAG_MSG_TYPE_RESPONSE);
                connBuilder.build().writeDelimitedTo(out);
                RPCProtos.ResponseHeader.Builder builder =
                        RPCProtos.ResponseHeader.newBuilder();
                builder.setStatus(status);
                builder.build().writeDelimitedTo(out);
                if (error != null) {
                    RPCProtos.RspExceptionBody.Builder b =
                            RPCProtos.RspExceptionBody.newBuilder();
                    b.setExceptionName(errorClass);
                    b.setStackTrace(error);
                    b.build().writeDelimitedTo(out);
                } else {
                    if (value != null) {
                        ((Message) value).writeDelimitedTo(out);
                    }
                }
            } catch (IOException e) {
                logger.warn(new StringBuilder(512)
                        .append("Exception while creating response ")
                        .append(e).toString());
            }
            return buf.getBufferList();
        }
prepare and write the message into an list of byte buffers

@param value
@param status
@param errorClass
@param error
@return
inlong-tubemq/tubemq-core/src/main/java/org/apache/inlong/tubemq/corerpc/netty/NettyRpcServer.java