@Test
    void circularQueueOddNumHeadWrapAround() {
        final SignalQueue queue = new SignalQueue(obj -> 4);
        add(queue, 0, 10);
        assertRefCnt(0, 10, 1);
        assertThat(queue.size()).isEqualTo(10);
        queue.requestRemovalAheadOf(8);
        assertThat(queue.size()).isEqualTo(10); // removing elements happens when adding a element

        int removedLength = queue.addAndRemoveIfRequested(httpData(10));
        assertThat(removedLength).isEqualTo(8 * 4);
        assertThat(queue.size()).isEqualTo(3); // 11 - 8 elements
        assertRefCnt(0, 8, 0);
        assertRefCnt(8, 11, 1);

        add(queue, 11, 20);
        queue.requestRemovalAheadOf(20); // head wrap around happens
        assertRefCnt(8, 20, 1);
        assertThat(queue.elements.length).isEqualTo(16);

        removedLength = queue.addAndRemoveIfRequested(httpData(20));
        assertRefCnt(0, 20, 0);
        assertRefCnt(20, 21, 1);
        assertThat(removedLength).isEqualTo(12 * 4);

        add(queue, 21, 40); // queue expansion happens
        assertThat(queue.elements.length).isEqualTo(32);
        assertRefCnt(0, 20, 0);
        assertRefCnt(20, 40, 1);

        for (int i = 20; i < 40; i++) {
            assertThat(((HttpData) queue.get(i)).byteBuf().readInt()).isEqualTo(i);
        }
        assertThat(queue.size()).isEqualTo(20);
        queue.clear(null);
        assertRefCnt(0, 40, 0);
    }
A test for the {@link SignalQueue} in {@link DefaultStreamMessageDuplicator}.
Queue expansion behaves differently when odd/even number head wrap-around happens.
core/src/test/java/com/linecorp/armeria/common/stream/StreamMessageDuplicatorTest.java