List of usage examples for io.netty.handler.codec.http.websocketx TextWebSocketFrame retain
@Override
public TextWebSocketFrame retain()
From source file:org.jboss.aerogear.simplepush.server.netty.WebSocketClientHandler.java
License:Apache License
@Override public void messageReceived(final ChannelHandlerContext ctx, Object msg) throws Exception { final Channel ch = ctx.channel(); if (!handshaker.isHandshakeComplete()) { handshaker.finishHandshake(ch, (FullHttpResponse) msg); handshakeFuture.setSuccess();/* w ww . ja v a2 s . com*/ return; } if (msg instanceof FullHttpResponse) { FullHttpResponse response = (FullHttpResponse) msg; throw new Exception("Unexpected FullHttpResponse (getStatus=" + response.getStatus() + ", content=" + response.content().toString(CharsetUtil.UTF_8) + ')'); } final WebSocketFrame frame = (WebSocketFrame) msg; if (frame instanceof TextWebSocketFrame) { final TextWebSocketFrame textFrame = (TextWebSocketFrame) frame; textFrame.retain(); textFrames.offer(textFrame); } else if (frame instanceof CloseWebSocketFrame) { ch.close(); } }