@@ -0,0 +1,1788 @@
+package alien4cloud.it.utils.websocket;%0A%0Aimport java.nio.charset.Charset;%0Aimport java.util.Set;%0A%0Aimport lombok.extern.slf4j.Slf4j;%0Aimport io.netty.buffer.ByteBuf;%0Aimport io.netty.channel.ChannelHandlerContext;%0Aimport io.netty.channel.ChannelPromise;%0Aimport io.netty.handler.codec.http.*;%0Aimport io.netty.handler.codec.http.websocketx.TextWebSocketFrame;%0Aimport io.netty.handler.codec.http.websocketx.WebSocketFrame;%0Aimport io.netty.handler.timeout.WriteTimeoutHandler;%0Aimport io.netty.util.AttributeKey;%0Aimport io.netty.util.ReferenceCountUtil;%0A%0A@Slf4j%0Apublic class WebSocketClientOutHandler extends WriteTimeoutHandler %7B%0A%0A    public WebSocketClientOutHandler (int timeout) %7B%0A      super(timeout);%0A    %7D%0A%0A    private final AttributeKey%3CSet%3CCookie%3E%3E ctxCookies = AttributeKey.valueOf(%22cookies%22);%0A%0A    @Override%0A    public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception %7B%0A        if (msg instanceof HttpRequest) %7B%0A            Set%3CCookie%3E cookies = ctx.attr(ctxCookies).get();%0A            if (cookies != null && !cookies.isEmpty()) %7B%0A                HttpRequest request = (HttpRequest) msg;%0A                request.headers().set(%22cookie%22, ClientCookieEncoder.encode(cookies));%0A                if (log.isDebugEnabled()) %7B%0A                    log.debug(%22Write HttpRequest %7B%7D enriched with security cookie%22, request);%0A                %7D%0A            %7D%0A            super.write(ctx, msg, promise);%0A            return;%0A        %7D%0A        String wrappedFrame = ((ByteBuf) msg).toString(Charset.forName(%22UTF-8%22));%0A        if (log.isDebugEnabled()) %7B%0A            log.debug(%22Write text frame %7B%7D%22, wrappedFrame);%0A        %7D%0A        WebSocketFrame webSocketFrame = new TextWebSocketFrame(wrappedFrame);%0A        super.write(ctx, webSocketFrame, promise);%0A    %7D%0A%0A%7D%0A

Upgrade ES 6 (new for alien4cloud-rest-it/netty4)