diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpContentEncoder.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpContentEncoder.java index 0e36b77495..b81edd133a 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpContentEncoder.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpContentEncoder.java @@ -67,7 +67,7 @@ public abstract class HttpContentEncoder extends MessageToMessageCodec { } @Override - public Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception { + protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception { // Discard all data received if closing handshake was received before. if (receivedClosingHandshake) { in.skipBytes(actualReadableBytes()); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket00FrameEncoder.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket00FrameEncoder.java index cb62ebd5a9..3f827a0e15 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket00FrameEncoder.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket00FrameEncoder.java @@ -33,7 +33,7 @@ import io.netty.handler.codec.MessageToByteEncoder; public class WebSocket00FrameEncoder extends MessageToByteEncoder { @Override - public void encode(ChannelHandlerContext ctx, WebSocketFrame msg, ByteBuf out) throws Exception { + protected void encode(ChannelHandlerContext ctx, WebSocketFrame msg, ByteBuf out) throws Exception { if (msg instanceof TextWebSocketFrame) { // Text frame ByteBuf data = msg.data(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java index 81161adc20..d96cbc6c79 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java @@ -117,8 +117,7 @@ public class WebSocket08FrameDecoder extends ReplayingDecoder { } @Override - public Object decode(ChannelHandlerContext ctx, Object msg) throws Exception { + protected Object decode(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof SpdySynStreamFrame) { // HTTP requests/responses are mapped one-to-one to SPDY streams. diff --git a/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHttpEncoder.java b/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHttpEncoder.java index ea3d9a3cc7..fe8fe31f07 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHttpEncoder.java +++ b/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHttpEncoder.java @@ -139,7 +139,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder { } @Override - public Object encode(ChannelHandlerContext ctx, HttpObject msg) throws Exception { + protected Object encode(ChannelHandlerContext ctx, HttpObject msg) throws Exception { List out = new ArrayList(); if (msg instanceof HttpRequest) { diff --git a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAuthRequestDecoder.java b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAuthRequestDecoder.java index 31ff08649f..7485b37f3c 100644 --- a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAuthRequestDecoder.java +++ b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksAuthRequestDecoder.java @@ -42,7 +42,7 @@ public class SocksAuthRequestDecoder extends ReplayingDecoder @Override @SuppressWarnings("unchecked") - public Object encode(ChannelHandlerContext ctx, Object msg) throws Exception { + protected Object encode(ChannelHandlerContext ctx, Object msg) throws Exception { return MessageToMessageCodec.this.encode(ctx, (OUTBOUND_IN) msg); } @@ -86,7 +86,7 @@ public abstract class MessageToMessageCodec @Override @SuppressWarnings("unchecked") - public Object decode(ChannelHandlerContext ctx, Object msg) throws Exception { + protected Object decode(ChannelHandlerContext ctx, Object msg) throws Exception { return MessageToMessageCodec.this.decode(ctx, (INBOUND_IN) msg); } diff --git a/codec/src/test/java/io/netty/handler/codec/ReplayingDecoderTest.java b/codec/src/test/java/io/netty/handler/codec/ReplayingDecoderTest.java index a3f9948183..f28e076a59 100644 --- a/codec/src/test/java/io/netty/handler/codec/ReplayingDecoderTest.java +++ b/codec/src/test/java/io/netty/handler/codec/ReplayingDecoderTest.java @@ -15,15 +15,15 @@ */ package io.netty.handler.codec; -import static org.junit.Assert.*; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufIndexFinder; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.embedded.EmbeddedByteChannel; - import org.junit.Test; +import static org.junit.Assert.*; + public class ReplayingDecoderTest { @Test @@ -53,7 +53,7 @@ public class ReplayingDecoderTest { } @Override - public ByteBuf decode(ChannelHandlerContext ctx, ByteBuf in) { + protected ByteBuf decode(ChannelHandlerContext ctx, ByteBuf in) { ByteBuf msg = in.readBytes(in.bytesBefore(ByteBufIndexFinder.LF)); in.skipBytes(1); return msg; diff --git a/example/src/main/java/io/netty/example/factorial/BigIntegerDecoder.java b/example/src/main/java/io/netty/example/factorial/BigIntegerDecoder.java index 8417a2285b..692fe8a944 100644 --- a/example/src/main/java/io/netty/example/factorial/BigIntegerDecoder.java +++ b/example/src/main/java/io/netty/example/factorial/BigIntegerDecoder.java @@ -31,7 +31,7 @@ import java.math.BigInteger; public class BigIntegerDecoder extends ByteToMessageDecoder { @Override - public BigInteger decode(ChannelHandlerContext ctx, ByteBuf in) { + protected BigInteger decode(ChannelHandlerContext ctx, ByteBuf in) { // Wait until the length prefix is available. if (in.readableBytes() < 5) { return null; diff --git a/example/src/main/java/io/netty/example/factorial/NumberEncoder.java b/example/src/main/java/io/netty/example/factorial/NumberEncoder.java index 7342a26fd3..f667d64926 100644 --- a/example/src/main/java/io/netty/example/factorial/NumberEncoder.java +++ b/example/src/main/java/io/netty/example/factorial/NumberEncoder.java @@ -29,7 +29,7 @@ import java.math.BigInteger; public class NumberEncoder extends MessageToByteEncoder { @Override - public void encode(ChannelHandlerContext ctx, Number msg, ByteBuf out) throws Exception { + protected void encode(ChannelHandlerContext ctx, Number msg, ByteBuf out) throws Exception { // Convert to a BigInteger first for easier implementation. BigInteger v; if (msg instanceof BigInteger) {