assertTrue("BigInteger == BigInteger2", data2.equals(data));
}
public void testStreamMessage() throws Exception
{
log.info("+++ testStreamMessage");
StreamMessage sent = session.createStreamMessage();
sent.writeBoolean(true);
sent.writeByte((byte) 1);
byte[] testBytes = "Bytes".getBytes();
sent.writeBytes(testBytes);
sent.writeChar('c');
sent.writeShort((short) 31415);
sent.writeInt(314159);
sent.writeLong(3141592653589793238L);
sent.writeDouble(3.1415926535897932384626433832795);
sent.writeFloat(3.141f);
sent.writeObject("31415926535897932384626433832795");
sent.writeString("31415926535897932384626433832795");
StreamMessage recv = (StreamMessage) sendRecMsg(sent);
log.debug("recv: "+recv);
assertTrue("Boolean == true", recv.readBoolean() == true);
assertTrue("Byte == 1", recv.readByte() == 1);
// Quirky spec behavior requires a read past the end of the byte[] field
byte[] bytes = new byte[testBytes.length];
recv.readBytes(bytes);
assertTrue(recv.readBytes(bytes) < 0);
assertTrue("Bytes == Bytes[]",
Arrays.equals(bytes, testBytes));
char c = recv.readChar();
assertTrue("Char == c", c == 'c');
assertTrue("Short == 314159", recv.readShort() == 31415);
assertTrue("Int == 314159", recv.readInt() == 314159);
assertTrue("Long == 3141592653589793238L",
recv.readLong() == 3141592653589793238L);
assertTrue("Double == 3.1415926535897932384626433832795",
recv.readDouble() == 3.1415926535897932384626433832795);
assertTrue("Float == true", recv.readFloat() == 3.141f);
assertTrue("Object == 31415926535897932384626433832795",
recv.readObject().equals("31415926535897932384626433832795"));
assertTrue("String == 31415926535897932384626433832795",
recv.readString().equals("31415926535897932384626433832795"));
}