@Test
    void shouldCompleteWhenConsumingAllElements() throws InterruptedException {
        final DefaultStreamMessage<String> streamMessage = new DefaultStreamMessage<>();
        streamMessage.write("foo");
        streamMessage.whenConsumed().thenRun(() -> {});
        streamMessage.close();

        final AtomicBoolean completed = new AtomicBoolean();
        streamMessage.subscribe(new Subscriber<String>() {
            @Override
            public void onSubscribe(Subscription s) {
                s.request(1);
            }

            @Override
            public void onNext(String s) {}

            @Override
            public void onError(Throwable t) {}

            @Override
            public void onComplete() {
                completed.set(true);
            }
        });
        await().untilTrue(completed);
    }
Makes sure {@link Subscriber#onComplete()} is always invoked after
{@link Subscriber#onSubscribe(Subscription)} even if
{@link StreamMessage#subscribe(Subscriber, EventExecutor, SubscriptionOption...)}
is called from non-{@link EventLoop}.
core/src/test/java/com/linecorp/armeria/common/stream/DefaultStreamMessageTest.java