* a response or error. */
public List<ByteBuffer> respond(Transceiver transceiver) throws IOException {
ByteBufferInputStream bbi =
new ByteBufferInputStream(transceiver.readBuffers());
Decoder in = new BinaryDecoder(bbi);
ByteBufferOutputStream bbo =
new ByteBufferOutputStream();
Encoder out = new BinaryEncoder(bbo);
AvroRemoteException error = null;
RPCContext context = new RPCContext();
try {
Protocol remote = handshake(transceiver, in, out);
if (remote == null) // handshake failed
return bbo.getBufferList();
// read request using remote protocol specification
context.setRequestCallMeta(META_READER.read(null, in));
String messageName = in.readString(null).toString();
Message m = remote.getMessages().get(messageName);
if (m == null)
throw new AvroRuntimeException("No such remote message: "+messageName);
Object request = readRequest(m.getRequest(), in);