assertEquals(consumerID, dr2.getConsumerID());
assertEquals(serverId, dr2.getServerId()); assertEquals(consumerID, dr2.getConsumerId());
      public void testCallback() throws Exception      {         int consumerID = 12345678;                  JBossMessage m1 = new JBossMessage(123);         JBossMessage m2 = new JBossMessage(456);         JBossMessage m3 = new JBossMessage(789);                  List msgs = new ArrayList();                  MessageProxy del1 = JBossMessage.createThinDelegate(m1, 7);         MessageProxy del2 = JBossMessage.createThinDelegate(m2, 8);         MessageProxy del3 = JBossMessage.createThinDelegate(m3, 9);                  MessageTest.configureMessage(m1);         MessageTest.configureMessage(m2);         MessageTest.configureMessage(m3);                  msgs.add(del1);         msgs.add(del2);         msgs.add(del3);                           ClientDelivery dr = new ClientDelivery(msgs, consumerID);                  ByteArrayOutputStream bos = new ByteArrayOutputStream();                  MessagingObjectOutputStream oos = new MessagingObjectOutputStream(new DataOutputStream(bos));                  MessagingMarshallable mm = new MessagingMarshallable((byte)77, dr);                  InvocationRequest ir = new InvocationRequest(null, null, mm, null, null, null);                  wf.write(ir, oos);                  oos.flush();                  ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());                           DataInputStream dis = new DataInputStream(bis);                  //Check the bytes                  //First byte should be version         assertEquals(77, dis.readByte());                           //Second byte should be CALLBACK         assertEquals(JMSWireFormat.CALLBACK, dis.readByte());                  //Next int should be consumer id         assertEquals(12345678, dis.readInt());                  //Next int should be number of messages         assertEquals(3, dis.readInt());                                    //Next byte should be type         assertEquals(JBossMessage.TYPE, dis.readByte());                  //Next int should be delivery count         assertEquals(7, dis.readInt());                  //And now the message itself         JBossMessage r1 = new JBossMessage();                  r1.read(dis);                           //Next byte should be type         assertEquals(JBossMessage.TYPE, dis.readByte());                  //Next int should be delivery count         assertEquals(8, dis.readInt());                  //And now the message itself         JBossMessage r2 = new JBossMessage();                  r2.read(dis);                           //Next byte should be type         assertEquals(JBossMessage.TYPE, dis.readByte());                  //Next int should be delivery count         assertEquals(9, dis.readInt());                  //And now the message itself         JBossMessage r3 = new JBossMessage();                  r3.read(dis);                  MessageTest.ensureEquivalent(m1, r1);         MessageTest.ensureEquivalent(m2, r2);         MessageTest.ensureEquivalent(m3, r3);                  //eos         try         {            dis.readByte();            fail("End of stream expected");         }         catch (EOFException e)         {            //Ok         }                  bis.reset();                  MessagingObjectInputStream ois = new MessagingObjectInputStream(new DataInputStream(bis));                  InvocationRequest ir2 = (InvocationRequest)wf.read(ois, null);                  mm = (MessagingMarshallable)ir2.getParameter();                  assertEquals(77, mm.getVersion());                           ClientDelivery dr2 = (ClientDelivery)mm.getLoad();                  List msgs2 = dr2.getMessages();                  assertEquals(consumerID, dr2.getConsumerID());                  MessageProxy p1 = (MessageProxy)msgs2.get(0);         MessageProxy p2 = (MessageProxy)msgs2.get(1);         MessageProxy p3 = (MessageProxy)msgs2.get(2);                  assertEquals(del1.getDeliveryCount(), p1.getDeliveryCount());         assertEquals(del2.getDeliveryCount(), p2.getDeliveryCount());         assertEquals(del3.getDeliveryCount(), p3.getDeliveryCount());                  JBossMessage q1 = p1.getMessage();         JBossMessage q2 = p1.getMessage();         JBossMessage q3 = p1.getMessage();                  MessageTest.ensureEquivalent(m1, q1);         MessageTest.ensureEquivalent(m2, q2);         MessageTest.ensureEquivalent(m3, q3);               }