diff --git a/transport/src/main/java/io/netty/channel/ChannelHandler.java b/transport/src/main/java/io/netty/channel/ChannelHandler.java index 898f7523bc..f9401080eb 100644 --- a/transport/src/main/java/io/netty/channel/ChannelHandler.java +++ b/transport/src/main/java/io/netty/channel/ChannelHandler.java @@ -73,13 +73,12 @@ import java.lang.annotation.Target; * * {@code @Override} * public void channelRead0({@link ChannelHandlerContext} ctx, Message message) { - * {@link Channel} ch = e.getChannel(); * if (message instanceof LoginMessage) { * authenticate((LoginMessage) message); * loggedIn = true; * } else (message instanceof GetDataMessage) { * if (loggedIn) { - * ch.write(fetchSecret((GetDataMessage) message)); + * ctx.writeAndFlush(fetchSecret((GetDataMessage) message)); * } else { * fail(); * } @@ -123,13 +122,12 @@ import java.lang.annotation.Target; * {@code @Override} * public void channelRead({@link ChannelHandlerContext} ctx, Message message) { * {@link Attribute}<{@link Boolean}> attr = ctx.attr(auth); - * {@link Channel} ch = ctx.channel(); * if (message instanceof LoginMessage) { * authenticate((LoginMessage) o); * attr.set(true); * } else (message instanceof GetDataMessage) { * if (Boolean.TRUE.equals(attr.get())) { - * ch.write(fetchSecret((GetDataMessage) o)); + * ctx.writeAndFlush(fetchSecret((GetDataMessage) o)); * } else { * fail(); * }