@VisibleForTesting
    HttpResponseMessage getZuulResponse() {
        return zuulResponse;
    }
@Test
    public void clearReferenceOnComplete() {
        ClientResponseWriter responseWriter = new ClientResponseWriter(new BasicRequestCompleteHandler());
        EmbeddedChannel channel = new EmbeddedChannel(responseWriter);

        AtomicReference<HttpResponse> nettyResp = new AtomicReference<>();
        channel.pipeline().addFirst(new ChannelOutboundHandlerAdapter() {
            @Override
            public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
                if (msg instanceof HttpResponse response) {
                    nettyResp.set(response);
                }
                ReferenceCountUtil.safeRelease(msg);
            }
        });

        SessionContext ctx = new SessionContext();
        HttpRequestMessage request = new HttpRequestBuilder(ctx).build();
        request.storeInboundRequest();
        HttpResponseMessageImpl response = new HttpResponseMessageImpl(ctx, request, 200);
        response.setHeaders(new Headers());

        channel.attr(ClientRequestReceiver.ATTR_ZUUL_REQ).set(request);
        DefaultHttpRequest nettyRequest = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/");
        ctx.set(CommonContextKeys.NETTY_HTTP_REQUEST, nettyRequest);

        channel.pipeline().fireUserEventTriggered(new HttpLifecycleChannelHandler.StartEvent(nettyRequest));
        channel.writeInbound(response);

        HttpResponseMessage zuulResponse = responseWriter.getZuulResponse();
        assertNotNull(zuulResponse);
        assertNotNull(nettyResp.get());

        channel.pipeline()
                .fireUserEventTriggered(new HttpLifecycleChannelHandler.CompleteEvent(
                        HttpLifecycleChannelHandler.CompleteReason.SESSION_COMPLETE, null, nettyResp.get()));
        assertNull(responseWriter.getZuulResponse());
    }