@Test
    void raiseExceptionInOnNext() {
        final StreamWriter<HttpData> publisher = StreamMessage.streaming();
        final StreamMessageDuplicator<HttpData> duplicator =
                publisher.toDuplicator(ImmediateEventExecutor.INSTANCE);

        final HttpData httpData = httpData(0);
        publisher.write(httpData);
        assertThat(httpData.byteBuf().refCnt()).isOne();

        // Release the buf after writing to the publisher which must not happen!
        httpData.byteBuf().release();

        final HttpDataSubscriber subscriber = new HttpDataSubscriber();
        duplicator.duplicate().subscribe(subscriber, ImmediateEventExecutor.INSTANCE);
        assertThatThrownBy(() -> subscriber.completionFuture().join()).hasCauseInstanceOf(
                IllegalReferenceCountException.class);
    }
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