{
Message msg = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
assertEquals((msg != null), true);
BytesBody mapMessage = Payload.createBytesBody(msg);
try
{
mapMessage.readMode();
fail();
}
catch (Exception ex)
{
}
try
{
mapMessage.writeBoolean(true);
fail();
}
catch (IncompatibleModeException ex)
{
}
mapMessage.writeMode();
mapMessage.writeInt(12345);
mapMessage.writeUTFString("hello world");
mapMessage.writeShort((short) 10);
mapMessage.writeBoolean(true);
mapMessage.flush();
mapMessage.readMode();
assertEquals(mapMessage.readInt(), 12345);
assertEquals(mapMessage.readUTFString(), "hello world");
assertEquals(mapMessage.readShort(), (short) 10);
assertEquals(mapMessage.readBoolean(), true);
}