*/
public List<ByteBuffer> getBytes()
throws Exception {
if (requestBytes == null) {
ByteBufferOutputStream bbo = new ByteBufferOutputStream();
BinaryEncoder out = ENCODER_FACTORY.binaryEncoder(bbo, encoder);
// use local protocol to write request
Message m = getMessage();
context.setMessage(m);
writeRequest(m.getRequest(), request, out); // write request payload
out.flush();
List<ByteBuffer> payload = bbo.getBufferList();
writeHandshake(out); // prepend handshake if needed
context.setRequestPayload(payload);
for (RPCPlugin plugin : rpcMetaPlugins) {
plugin.clientSendRequest(context); // get meta-data from plugins
}
META_WRITER.write(context.requestCallMeta(), out);
out.writeString(m.getName()); // write message name
out.flush();
bbo.append(payload);
requestBytes = bbo.getBufferList();
}
return requestBytes;