@Override public void sendResponse(Streamable message, TransportResponseOptions options) throws IOException { HandlesStreamOutput stream = CachedStreamOutput.cachedHandlesBytes(); stream.writeLong(requestId); byte status = 0; status = TransportStreams.statusSetResponse(status); stream.writeByte(status); // 0 for request, 1 for response. message.writeTo(stream); final byte[] data = ((BytesStreamOutput) stream.wrappedOut()).copiedByteArray(); targetTransport .threadPool() .execute( new Runnable() { @Override public void run() { targetTransport.messageReceived(data, action, sourceTransport, null); } }); }