encodeReply method
return reply message, it is diff from request
Implementation
OutputStream encodeReply() {
assert(header.type == MessageType.reply);
final out = OutputStream();
// params
final paramsStream = OutputStream();
writeParams(paramsStream);
final int encapByteLength = paramsStream.lengthInBytes + 6;
// prepare header
// body length = 5
out.writeHeader(
header.apply(size: headerSize + 5 + encapByteLength),
);
// reply body
out.writeInt(requestId!);
out.writeByte(status!.index);
out.writeEncapsulation(Encapsulation(
size: encapByteLength,
major: 1,
minor: 1,
));
out.writeBlob(paramsStream.finished());
return out;
}