protected PacketWriter writer;
protected PacketReader reader;
protected int packetCount = 10;
public void testWireFormat() throws IOException, JMSException {
WireFormat wireFormat = new DefaultWireFormat();
Packet packet = createPacket();
System.out.println("Created packet: " + packet + " with type: " + packet.getPacketType());
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
DataOutputStream dataOut = new DataOutputStream(buffer);
wireFormat.writePacket(packet, dataOut);
dataOut.close();
byte[] bytes = buffer.toByteArray();
DataInputStream dataIn = new DataInputStream(new ByteArrayInputStream(bytes));
int type = dataIn.readByte();
System.out.println("Read type: " + type);
Packet otherPacket = wireFormat.readPacket(type, dataIn);
System.out.println("Read packet: " + otherPacket);
assertPacket(otherPacket, packet);
}