@Test
public void testRecover() throws Exception {
final String serverURL1 = "meta://localhost:8123";
final String serverURL2 = "meta://localhost:8124";
final XATransactionId id1 = XIDGenerator.createXID(1);
final XATransactionId id2 = XIDGenerator.createXID(2);
final XATransactionId id3 = XIDGenerator.createXID(3);
final XATransactionId id4 = XIDGenerator.createXID(4);
this.mockInvokeSuccess(serverURL1, new TransactionInfo(null, this.sessionId, TransactionType.RECOVER),
id2.getTransactionKey() + "\r\n" + id3.getTransactionKey());
this.mockInvokeSuccess(serverURL2, new TransactionInfo(null, this.sessionId, TransactionType.RECOVER),
id1.getTransactionKey() + "\r\n" + id4.getTransactionKey());
this.replay();
OpaqueGenerator.resetOpaque();
this.context.setXareresourceURLs(new String[] { serverURL1, serverURL2 });
final Xid[] xids = this.context.recover(XAResource.TMNOFLAGS);
assertEquals(4, xids.length);