@Test(timeout=5000)
    public void pause() throws Exception {
        logTestStart();
        testedBy(RequestValidator.class, "validateSubsequentPause");

        final AtomicReference<AbstractBody> request =
                new AtomicReference<AbstractBody>();
        session.addBOSHClientRequestListener(new BOSHClientRequestListener() {
            public void requestSent(final BOSHMessageEvent event) {
                request.set(event.getBody());
            }
        });

        // Initiate a session with a maxpause and empty requests enabled.
        session.send(ComposableBody.builder().build());
        StubConnection conn = cm.awaitConnection();
        AbstractBody req = conn.getRequest().getBody();
        AbstractBody scr = getSessionCreationResponse(req)
                .setAttribute(Attributes.POLLING, "1")
                .setAttribute(Attributes.MAXPAUSE, "2")
                .setAttribute(Attributes.DISABLE_EMPTY_MESSAGES, null)
                .build();
        conn.sendResponse(scr);
        session.drain();

        // Send the pause request
        request.set(null);
        boolean result = session.pause();
        assertTrue(result);
        
        // Drain any empty requests, followed by the pause request.  The final
        // request the CM receives is the pause request.
        while(true) {
            conn = cm.awaitConnection();
            conn.sendResponse(ComposableBody.builder().build());
            if(conn.getRequest().getBody().getAttribute(Attributes.PAUSE) != null)
                break;
        }
        req = request.getAndSet(null);
        assertEquals(scr.getAttribute(Attributes.MAXPAUSE),
                req.getAttribute(Attributes.PAUSE));

        try {
            // Give the client a chance to send an empty request; this should not
            // happen.
            Thread.sleep(1200);
            assertNull(request.get());
            Thread.sleep(1000);
        } catch (InterruptedException intx) {
            fail("Interrupted while waiting");
        }

        // After the second pause and two seconds have elapsed, the empty request
        // to wake the session from pause should have been sent.
        req = request.get();
        assertNotNull(req);
    }