@Override
    public void onNext(HttpObject httpObject) {
        assert subscription != null;

        final boolean eos = httpObject.isEndOfStream();
        if (httpObject instanceof HttpHeaders) {
            subscriber.onHeaders((HttpHeaders) httpObject);
        } else {
            final HttpData httpData = (HttpData) httpObject;
            final int dataLength = httpData.length();
            if (dataLength > 0) {
                final long allowedDataLength = MAX_ALLOWED_DATA_LENGTH - contentLength;
                if (dataLength > allowedDataLength) {
                    onError(new IllegalStateException(
                            "content length greater than " + MAX_ALLOWED_DATA_LENGTH));
                    subscription.cancel();
                    return;
                }
                contentLength += dataLength;
                // handle data object
                try {
                    subscriber.onData(httpData);
                } finally {
                    ReferenceCountUtil.safeRelease(httpData); // release all Netty allocated resources
                }
            }
        }
        if (eos) {
            subscriber.onComplete();
        }
    }
An adapter of {@link HttpMessageSubscriber} to {@link Subscriber}.
resteasy/src/main/java/com/linecorp/armeria/internal/common/resteasy/HttpMessageSubscriberAdapter.java