@Test(timeout=5000)
    public void testMultiplePacketRetransmission() throws Exception {
        logTestStart();
        session.addBOSHClientConnListener(disc);

        // Open the connection.
        session.send(ComposableBody.builder().build());
        StubConnection conn = cm.awaitConnection();
        AbstractBody scr = getSessionCreationResponse(conn.getRequest().getBody()).build();
        conn.sendResponse(scr);
        session.drain();

        // Send two requests.
        ComposableBody packet1 = ComposableBody.builder().build();
        ComposableBody packet2 = ComposableBody.builder().build();
        session.send(packet1);
        session.send(packet2);

        // Close both connections without sending a response.
        String expectedRid1 = getRIDAndClose();
        String expectedRid2 = getRIDAndClose();

        // Wait for the client to see the disconnection.
        disc.waitForDisconnection();
        assertTrue(session.isRecoverableConnectionLoss());

        // Both requests will be resent on reconnection.
        session.attemptReconnection();
        String rid1 = getRIDAndClose();
        String rid2 = getRIDAndClose();

        // The retransmissions may be received in either order, since this test doesn't
        // use pipelining.  TestPipelining tests this more thoroughly.
        if(expectedRid1.equals(rid1) && expectedRid2.equals(rid2))
            ; // OK
        else if(expectedRid1.equals(rid2) && expectedRid2.equals(rid1))
            ; // OK
        else {
            fail("Expected RID " + expectedRid1 + " and " + expectedRid2 +
                    ", got " + rid1 + ", " + rid2);
        }
    }