static void sendTrailingHeaders(final ChannelHandlerContext ctx, final HttpResponseStatus statusCode, final String exceptionType) {
        final DefaultLastHttpContent defaultLastHttpContent = new DefaultLastHttpContent();
        defaultLastHttpContent.trailingHeaders().add(SerTokens.TOKEN_CODE, statusCode.code());
        if (exceptionType != null && !exceptionType.isEmpty()) {
            defaultLastHttpContent.trailingHeaders().add(SerTokens.TOKEN_EXCEPTION, exceptionType);
        }

        ctx.writeAndFlush(defaultLastHttpContent);
    }
Adds trailing headers specified in the arguments to a {@link DefaultLastHttpContent} and then flushes it. This
serves as the end of a response.

@param ctx           The netty context.
@param statusCode    The status code to include in the trailers.
@param exceptionType The type of exception to include in the trailers. Leave blank or null if no error occurred.
gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpHandlerUtil.java