public void putMessage0(GenericNetworkMessage msg) throws IOException { final TCConnection source = msg.getSource(); if (verify) { verifyIncomingMessage(source, msg); } // copy the message and send it right back to the client TCByteBuffer[] recvData = msg.getPayload(); TCByteBufferOutputStream out = new TCByteBufferOutputStream(); TCByteBufferInputStream in = new TCByteBufferInputStream(recvData); final int bytesCopied = CopyUtils.copy(in, out); Assert.assertEquals(bytesCopied, msg.getDataLength()); GenericNetworkMessage send = new GenericNetworkMessage(source, out.toArray()); Assert.assertEquals(msg.getDataLength(), send.getDataLength()); send.setSequence(msg.getSequence()); send.setClientNum(msg.getClientNum()); if (verify) { compareData(msg.getEntireMessageData(), send.getEntireMessageData()); } source.putMessage(send); }
private TCByteBuffer[] write(DmiDescriptor dd) { final TCByteBufferOutputStream out = new TCByteBufferOutputStream(); dd.serializeTo(out); out.close(); return out.toArray(); }