assertTrue(reader.getPacketType()==Packet.CONSUMER_INFO);
}
public void testReadPacket()
{
ConsumerInfo info = new ConsumerInfo();
info.setConsumerId(consumerId);
info.setConsumerNo(this.consumerNo);
info.setPrefetchNumber(this.prefetchNumber);
info.setClientId(this.clientId);
info.setConsumerName(this.subscriberName);
info.setSelector(this.selector);
info.setDestination(this.destination);
info.setStartTime(this.startTime);
info.setStarted(this.started);
ConsumerInfoWriter writer = new ConsumerInfoWriter();
ConsumerInfoReader reader = new ConsumerInfoReader();
try {
byte[] data = writer.writePacketToByteArray(info);
ConsumerInfo testInfo = (ConsumerInfo) reader.readPacketFromByteArray(data);
assertTrue(testInfo.getConsumerId().equals(this.consumerId));
assertTrue(testInfo.getConsumerNo()==this.consumerNo);
assertTrue(testInfo.getPrefetchNumber() == this.prefetchNumber);
assertTrue(testInfo.getClientId().equals(this.clientId));
assertTrue(testInfo.getConsumerName().equals(this.subscriberName));
assertTrue(testInfo.getSelector().equals(this.selector));
assertTrue(testInfo.getDestination().equals(this.destination));
assertTrue(testInfo.getStartTime() == this.startTime);
assertTrue(testInfo.isStarted()==this.started);
}catch(Throwable e){
e.printStackTrace();
assertTrue(false);
}
}