cr.start();
RegionManager rm = cr.getComponent(RegionManager.class);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
final Fqn region = Fqn.fromString("/hello");
Region r = rm.getRegion(region, true);
r.registerContextClassLoader(this.getClass().getClassLoader());
cm200.objectToObjectStream(new ClusteredGetCommand(false, null), oos, region);
oos.close();
final byte[] stream = baos.toByteArray();
// so now the stream starts with the Fqn "/hello".
// repeat 100 times
for (int i = 0; i < 100; i++)
{
if (i % 3 == 0)
{
// task 1 above
e.execute(new Runnable()
{
public void run()
{
try
{
RegionalizedMethodCall rmc = cm200.regionalizedMethodCallFromObjectStream(new ObjectInputStream(new ByteArrayInputStream(stream)));
ByteArrayOutputStream out = new ByteArrayOutputStream();
ObjectOutputStream outStream = new ObjectOutputStream(out);
RegionalizedReturnValue rrv = new RegionalizedReturnValue("A result", rmc);
cm200.objectToObjectStream(rrv, outStream);
outStream.close();
out.close();
// test that the output stream has got "/hello" as it's region Fqn.
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(out.toByteArray()));
assert in.readByte() == CacheMarshaller200.MAGICNUMBER_FQN : "The stream should start with an Fqn";
// discard the nest refId short
in.readShort();
Fqn f = cm200.unmarshallFqn(in, new UnmarshalledReferences());
assert region.equals(f) : "Should use the same region for the response as was used for the request!";
}
catch (Throwable t)
{