byte[] bytes = new byte[baos.size()];
System.arraycopy(baos.getRawBuffer(), 0, bytes, 0, bytes.length);
// Read
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ObjectInput globalOI = globalMarshal.startObjectInput(bais, false);
try {
assertEquals(address, globalOI.readObject());
/** BEGIN: Special treatment **/
int offset = globalOI.readInt();
// Now try the cache marshaller and borrow the input stream to read
StreamingMarshaller cacheMarshaller = extractCacheMarshaller(cm.getCache());
// Advance 4 bytes to go over the number of bytes written
bais = new ByteArrayInputStream(bytes, offset + 4, bytes.length);
ObjectInput cacheOI = cacheMarshaller.startObjectInput(bais, true);
/** END: Special treatment **/
try {
assertEquals(cmd, cacheOI.readObject());
} finally {
cacheMarshaller.finishObjectInput(cacheOI);
}
} finally {
globalMarshal.finishObjectInput(globalOI);