List of usage examples for io.netty.util ReferenceCountUtil release
public static boolean release(Object msg)
From source file:com.yeetor.server.handler.WSHandler.java
License:Open Source License
@Override protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof FullHttpRequest) { FullHttpRequest req = (FullHttpRequest) msg; if (!req.getDecoderResult().isSuccess() || (!"websocket".equals(req.headers().get("Upgrade")))) { ctx.fireChannelRead(req);//from w ww .j a va 2 s . c o m return; } handleWSConnect(ctx, req); } else if (msg instanceof WebSocketFrame) { WebSocketFrame frame = (WebSocketFrame) msg; handlerWebSocketFrame(ctx, frame); } if (!autorelease) ReferenceCountUtil.release(msg); }
From source file:com.zhucode.longio.transport.netty.HttpClientHandler.java
License:Open Source License
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { try {// www. j a v a2s. c om if (handshaker == null) { handleHttp(ctx, msg); } else { handleWebsocket(ctx, msg); } } finally { ReferenceCountUtil.release(msg); } }
From source file:com.zhucode.longio.transport.netty.HttpHandler.java
License:Open Source License
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { try {//from ww w. j a v a 2 s. c om if (msg instanceof FullHttpRequest) { handleHttpRequest(ctx, (FullHttpRequest) msg); } else if (msg instanceof WebSocketFrame) { handleWebSocketFrame(ctx, (WebSocketFrame) msg); } } finally { ReferenceCountUtil.release(msg); } }
From source file:de.unipassau.isl.evs.ssh.core.network.ClientHandshakeHandler.java
License:Open Source License
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { Log.w(TAG, "Can't write data while authentication is pending, message was " + msg); ReferenceCountUtil.release(msg); }
From source file:de.unipassau.isl.evs.ssh.core.network.handler.CrypterTest.java
License:Open Source License
public void testRoundtrip() { ByteBuf buf = channel.alloc().buffer(); for (int c : new int[] { 1, 1, 5, 10, 50, 100, 500, 1000, 5000, 10000 }) { buf.capacity(c);//www . j a v a 2s. c o m while (buf.writableBytes() > 0) { buf.writeByte(c); } channel.writeOutbound(buf.duplicate().retain()); for (ByteBuf msg; (msg = channel.readOutbound()) != null;) { assertNotSame(buf, msg); channel.writeInbound(msg); } assertEquals(buf, channel.readInbound()); } ReferenceCountUtil.release(buf); }
From source file:de.unipassau.isl.evs.ssh.core.network.handler.PipelinePlug.java
License:Open Source License
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { Log.e(TAG, (msg != null ? msg.getClass().getName() : "null") + " packet reached end of pipeline: " + String.valueOf(msg)); ReferenceCountUtil.release(msg); }
From source file:de.unipassau.isl.evs.ssh.core.network.handler.PipelinePlug.java
License:Open Source License
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { Log.w(TAG, (evt != null ? evt.getClass().getName() : "null") + " event reached end of pipeline: " + String.valueOf(evt)); ReferenceCountUtil.release(evt); }
From source file:de.unipassau.isl.evs.ssh.core.network.handler.SignerTest.java
License:Open Source License
public void testRoundtrip() { ByteBuf buf = channel.alloc().buffer(); for (int c : new int[] { 1, 1, 5, 10, 50, 100, 500, 1000, 5000, 10000 }) { buf.capacity(c);// w ww . j a v a 2s. c o m while (buf.writableBytes() > 0) { buf.writeByte(c); } channel.writeOutbound(buf.duplicate().retain()); channel.runPendingTasks(); for (Object msg; (msg = channel.readOutbound()) != null;) { channel.writeInbound(msg); } assertEquals(buf, channel.readInbound()); } ReferenceCountUtil.release(buf); }
From source file:de.unipassau.isl.evs.ssh.core.network.handler.TimeoutHandler.java
License:Open Source License
/** * Calls {@link ChannelHandlerAdapter#channelRead(ChannelHandlerContext, Object)} when the sent message * is not an object of//from ww w. j a v a2 s.c o m * {@link de.unipassau.isl.evs.ssh.core.network.handler.TimeoutHandler.PingMessage PingMessage} class. */ @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof PingMessage) { // discard message ReferenceCountUtil.release(msg); } else { // forward message super.channelRead(ctx, msg); } }
From source file:dorkbox.network.connection.ConnectionImpl.java
License:Apache License
/** * @param context can be NULL when running deferred messages from registration process. * @param message the received message/* www .ja v a 2 s .co m*/ */ @Override public void channelRead(ChannelHandlerContext context, Object message) throws Exception { channelRead(message); ReferenceCountUtil.release(message); }