DeliveryInfo info = new DeliveryInfo(proxy, 76762, 98982);
DeliveryInfo info = new DeliveryInfo(proxy, 76762, 98982, null);
      public void testSendTransaction() throws Exception      {                JBossMessage m = new JBossMessage(123);         MessageTest.configureMessage(m);                  long deliveryId = 89281389;                  int deliveryCount = 12;                  MessageProxy proxy = JBossMessage.createThinDelegate(deliveryId, m, deliveryCount);                              DeliveryInfo info = new DeliveryInfo(proxy, 76762, 98982);                  int sessionId = 8787;                  ClientTransaction state = new ClientTransaction();         state.addMessage(sessionId, m);         state.addAck(sessionId, info);                   TransactionRequest request = new TransactionRequest(TransactionRequest.ONE_PHASE_COMMIT_REQUEST, null, state);                                    long methodHash = 62365354;                  int objectId = 54321;                  MethodInvocation mi = new MethodInvocation(null, methodHash, sendTransactionMethod, sendTransactionMethod, null);                  mi.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, new Integer(objectId));                     mi.setArguments(new Object[] {request});                  MessagingMarshallable mm = new MessagingMarshallable((byte)77, mi);                  InvocationRequest ir = new InvocationRequest(null, null, mm, null, null, null);                  ByteArrayOutputStream bos = new ByteArrayOutputStream();                  OutputStream oos = new DataOutputStream(bos);                           wf.write(ir, oos);                 oos.flush();                        byte[] bytes = bos.toByteArray();                       ByteArrayInputStream bis = new ByteArrayInputStream(bytes);                           DataInputStream dis = new DataInputStream(bis);                         //Check the bytes                      //First byte should be version         assertEquals(77, dis.readByte());                  //First byte should be SEND_TRANSACTION         assertEquals(JMSWireFormat.SEND_TRANSACTION, dis.readByte());                  //Next int should be objectId         assertEquals(objectId, dis.readInt());                  //Next long should be methodHash         assertEquals(methodHash, dis.readLong());                           //Next should come the transaction request                  TransactionRequest req = new TransactionRequest();                                  req.read(dis);                  //should be eos                         try         {            dis.readByte();            fail("End of stream expected");         }         catch (EOFException e)         {            //Ok         }                  ClientTransaction state2 = req.getState();                  Collection sessionStates = state2.getSessionStates();                  assertEquals(1, sessionStates.size());                  SessionTxState sess = (SessionTxState)sessionStates.iterator().next();         JBossMessage m2 = (JBossMessage)sess.getMsgs().get(0);                  MessageTest.ensureEquivalent(m, m2);                  assertEquals(TransactionRequest.ONE_PHASE_COMMIT_REQUEST, req.getRequestType());                  Ack ack = (Ack)sess.getAcks().get(0);                  assertEquals(deliveryId, ack.getDeliveryId());                  bis.reset();                  InputStream ois = new DataInputStream(bis);                  InvocationRequest ir2 = (InvocationRequest)wf.read(ois, null);                  mm = (MessagingMarshallable)ir2.getParameter();                  assertEquals(77, mm.getVersion());                  MethodInvocation mi2 = (MethodInvocation)mm.getLoad();                  assertEquals(methodHash, mi2.getMethodHash());                  assertEquals(objectId, ((Integer)mi2.getMetaData().getMetaData(Dispatcher.DISPATCHER, Dispatcher.OID)).intValue());                  TransactionRequest req2 = (TransactionRequest)mi2.getArguments()[0];                  ClientTransaction state3 = req2.getState();                  Collection sessionStates2 = state3.getSessionStates();                  SessionTxState sess2 = (SessionTxState)sessionStates2.iterator().next();                  JBossMessage m3 = (JBossMessage)sess2.getMsgs().get(0);                  MessageTest.ensureEquivalent(m, m3);                  assertEquals(TransactionRequest.ONE_PHASE_COMMIT_REQUEST, req2.getRequestType());                  Ack ack2 = (Ack)sess2.getAcks().get(0);                  assertEquals(deliveryId, ack2.getDeliveryId());               }  