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);
  }
 @Override
 protected void dehydrateValues() {
   TCByteBufferOutputStream outputStream = getOutputStream();
   // We don't want to use the NVpair stuff:  it is horrendously complicated, doesn't work well
   // with all types, and doesn't buy us anything.
   putNVPair(RECEIVED_ID, receivedIDs != null ? receivedIDs.size() : 0);
   if (receivedIDs != null) {
     for (TransactionID tid : receivedIDs) {
       outputStream.writeLong(tid.toLong());
     }
   }
   putNVPair(TRANSACTION_ID, retiredIDs != null ? retiredIDs.size() : 0);
   if (retiredIDs != null) {
     for (TransactionID tid : retiredIDs) {
       outputStream.writeLong(tid.toLong());
     }
   }
   putNVPair(RESULTS_ID, results != null ? results.size() : 0);
   if (results != null) {
     for (Map.Entry<TransactionID, byte[]> entries : results.entrySet()) {
       outputStream.writeLong(entries.getKey().toLong());
       outputStream.writeInt(entries.getValue().length);
       outputStream.write(entries.getValue());
     }
   }
 }
 private TCByteBuffer[] write(DmiDescriptor dd) {
   final TCByteBufferOutputStream out = new TCByteBufferOutputStream();
   dd.serializeTo(out);
   out.close();
   return out.toArray();
 }