@Test(timeout=5000)
    public void testSendWindow() throws Exception {
        // Send session initialization.
        session.send(ComposableBody.builder().build());

        StubConnection conn = cm.awaitConnection();
        AbstractBody req = conn.getRequest().getBody();

        // This test only makes sense if BOSHClient supports pipelining, which
        // is indicated by @hold being greater than 1.
        int hold = Integer.parseInt(req.getAttribute(Attributes.HOLD));
        assertTrue("Receive windowing is not enabled", hold > 1);

        int requests = hold + 1;

        // Send a session creation request acknowledging the higher hold size.
        AbstractBody scr = getSessionCreationResponse(req)
                .setAttribute(Attributes.HOLD, new Integer(hold).toString())
                .setAttribute(Attributes.REQUESTS, new Integer(requests).toString())
                .build();
        conn.sendResponse(scr);

        // We should be able to pipeline up to "requests" requests without blocking.
        for(int i = 0; i < requests; ++i)
            session.send(ComposableBody.builder().build());

        // The CM should receive all of the requests, without having to respond to
        // any of them.
        int expectedResponses = requests;
        while(expectedResponses > 0) {
            cm.awaitConnection();
            --expectedResponses;
        }
    }