Rename SimpleChannelInboundHandler.channelRead0() to messageReceived()
- Related: #1590
This commit is contained in:
parent
81243c1524
commit
9d611a182f
@ -75,7 +75,7 @@ public class AppletDiscardServer extends JApplet {
|
||||
private static final class DiscardServerHandler extends SimpleChannelInboundHandler<ByteBuf> {
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
|
||||
System.out.println("Received: " + msg.toString(CharsetUtil.UTF_8));
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class DiscardClientHandler extends SimpleChannelInboundHandler<Object> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
// Server is supposed to send nothing, but if it sends something, discard it.
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ public class DiscardServerHandler extends SimpleChannelInboundHandler<Object> {
|
||||
DiscardServerHandler.class.getName());
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
// discard
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class FactorialClientHandler extends SimpleChannelInboundHandler<BigInteg
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, final BigInteger msg) {
|
||||
public void messageReceived(ChannelHandlerContext ctx, final BigInteger msg) {
|
||||
receivedMessages ++;
|
||||
if (receivedMessages == count) {
|
||||
// Offer the answer after closing the connection.
|
||||
|
@ -39,7 +39,7 @@ public class FactorialServerHandler extends SimpleChannelInboundHandler<BigInteg
|
||||
private BigInteger factorial = new BigInteger("1");
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, BigInteger msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, BigInteger msg) throws Exception {
|
||||
// Calculate the cumulative factorial and send it to the client.
|
||||
lastMultiplier = msg;
|
||||
factorial = factorial.multiply(msg);
|
||||
|
@ -93,7 +93,7 @@ public class FileServer {
|
||||
|
||||
private static final class FileHandler extends SimpleChannelInboundHandler<String> {
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||
File file = new File(msg);
|
||||
if (file.exists()) {
|
||||
if (!file.isFile()) {
|
||||
|
@ -114,7 +114,7 @@ public class HttpStaticFileServerHandler extends SimpleChannelInboundHandler<Ful
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(
|
||||
public void messageReceived(
|
||||
ChannelHandlerContext ctx, FullHttpRequest request) throws Exception {
|
||||
if (!request.getDecoderResult().isSuccess()) {
|
||||
sendError(ctx, BAD_REQUEST);
|
||||
|
@ -27,7 +27,7 @@ import io.netty.util.CharsetUtil;
|
||||
public class HttpSnoopClientHandler extends SimpleChannelInboundHandler<HttpObject> {
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
|
||||
if (msg instanceof HttpResponse) {
|
||||
HttpResponse response = (HttpResponse) msg;
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class HttpSnoopServerHandler extends SimpleChannelInboundHandler<Object>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, Object msg) {
|
||||
protected void messageReceived(ChannelHandlerContext ctx, Object msg) {
|
||||
if (msg instanceof HttpRequest) {
|
||||
HttpRequest request = this.request = (HttpRequest) msg;
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class HttpUploadClientHandler extends SimpleChannelInboundHandler<HttpObj
|
||||
private boolean readingChunks;
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
|
||||
if (msg instanceof HttpResponse) {
|
||||
HttpResponse response = (HttpResponse) msg;
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class HttpUploadServerHandler extends SimpleChannelInboundHandler<HttpObj
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
|
||||
if (msg instanceof HttpRequest) {
|
||||
HttpRequest request = this.request = (HttpRequest) msg;
|
||||
URI uri = new URI(request.getUri());
|
||||
|
@ -79,7 +79,7 @@ public class WebSocketClientHandler extends SimpleChannelInboundHandler<Object>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
Channel ch = ctx.channel();
|
||||
if (!handshaker.isHandshakeComplete()) {
|
||||
handshaker.finishHandshake(ch, (FullHttpResponse) msg);
|
||||
|
@ -21,7 +21,7 @@ import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
|
||||
|
||||
public class CustomTextFrameHandler extends SimpleChannelInboundHandler<TextWebSocketFrame> {
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, TextWebSocketFrame frame) throws Exception {
|
||||
protected void messageReceived(ChannelHandlerContext ctx, TextWebSocketFrame frame) throws Exception {
|
||||
String request = frame.text();
|
||||
ctx.channel().writeAndFlush(new TextWebSocketFrame(request.toUpperCase()));
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class WebSocketServerHandler extends SimpleChannelInboundHandler<Object>
|
||||
private WebSocketServerHandshaker handshaker;
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
if (msg instanceof FullHttpRequest) {
|
||||
handleHttpRequest(ctx, (FullHttpRequest) msg);
|
||||
} else if (msg instanceof WebSocketFrame) {
|
||||
|
@ -54,7 +54,7 @@ public class WebSocketSslServerHandler extends SimpleChannelInboundHandler<Objec
|
||||
private WebSocketServerHandshaker handshaker;
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
if (msg instanceof FullHttpRequest) {
|
||||
handleHttpRequest(ctx, (FullHttpRequest) msg);
|
||||
} else if (msg instanceof WebSocketFrame) {
|
||||
|
@ -21,7 +21,7 @@ import io.netty.channel.SimpleChannelInboundHandler;
|
||||
public class LocalEchoClientHandler extends SimpleChannelInboundHandler<Object> {
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
// Print as received
|
||||
System.out.println(msg);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ import io.netty.util.CharsetUtil;
|
||||
public class QuoteOfTheMomentClientHandler extends SimpleChannelInboundHandler<DatagramPacket> {
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
|
||||
String response = msg.content().toString(CharsetUtil.UTF_8);
|
||||
if (response.startsWith("QOTM: ")) {
|
||||
System.out.println("Quote of the Moment: " + response.substring(6));
|
||||
|
@ -44,7 +44,7 @@ public class QuoteOfTheMomentServerHandler extends SimpleChannelInboundHandler<D
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, DatagramPacket packet) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, DatagramPacket packet) throws Exception {
|
||||
System.err.println(packet);
|
||||
if ("QOTM?".equals(packet.content().toString(CharsetUtil.UTF_8))) {
|
||||
ctx.write(new DatagramPacket(
|
||||
|
@ -26,7 +26,7 @@ public class RxtxClientHandler extends SimpleChannelInboundHandler<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||
if ("OK".equals(msg)) {
|
||||
System.out.println("Serial port responded to AT");
|
||||
} else {
|
||||
|
@ -30,7 +30,7 @@ public class SecureChatClientHandler extends SimpleChannelInboundHandler<String>
|
||||
SecureChatClientHandler.class.getName());
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||
System.err.println(msg);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class SecureChatServerHandler extends SimpleChannelInboundHandler<String>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||
// Send the received message to all channels but the current one.
|
||||
for (Channel c: channels) {
|
||||
if (c != ctx.channel()) {
|
||||
|
@ -42,8 +42,8 @@ public final class SocksServerConnectHandler extends SimpleChannelInboundHandler
|
||||
private final Bootstrap b = new Bootstrap();
|
||||
|
||||
@Override
|
||||
public void channelRead0(final ChannelHandlerContext ctx, final SocksCmdRequest request) throws Exception {
|
||||
Promise promise = ctx.executor().newPromise();
|
||||
public void messageReceived(final ChannelHandlerContext ctx, final SocksCmdRequest request) throws Exception {
|
||||
Promise<Channel> promise = ctx.executor().newPromise();
|
||||
promise.addListener(
|
||||
new GenericFutureListener<Future<Channel>>() {
|
||||
@Override
|
||||
|
@ -37,7 +37,7 @@ public final class SocksServerHandler extends SimpleChannelInboundHandler<SocksR
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, SocksRequest socksRequest) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, SocksRequest socksRequest) throws Exception {
|
||||
switch (socksRequest.requestType()) {
|
||||
case INIT: {
|
||||
// auth support example
|
||||
|
@ -31,7 +31,7 @@ public class TelnetClientHandler extends SimpleChannelInboundHandler<String> {
|
||||
private static final Logger logger = Logger.getLogger(TelnetClientHandler.class.getName());
|
||||
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||
protected void messageReceived(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||
System.err.println(msg);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class TelnetServerHandler extends SimpleChannelInboundHandler<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, String request) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, String request) throws Exception {
|
||||
|
||||
// Generate and write a response.
|
||||
String response;
|
||||
|
@ -58,7 +58,7 @@ public class ByteEchoClientHandler extends SimpleChannelInboundHandler<ByteBuf>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
|
||||
meter.mark(msg.readableBytes());
|
||||
|
||||
ctx.write(msg);
|
||||
|
@ -65,7 +65,7 @@ public class MsgEchoClientHandler extends SimpleChannelInboundHandler<UdtMessage
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, UdtMessage msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, UdtMessage msg) throws Exception {
|
||||
meter.mark(msg.content().readableBytes());
|
||||
|
||||
ctx.write(msg);
|
||||
|
@ -66,7 +66,7 @@ public class MsgEchoPeerHandler extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, UdtMessage message) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, UdtMessage message) throws Exception {
|
||||
meter.mark(message.content().readableBytes());
|
||||
|
||||
ctx.write(message);
|
||||
|
@ -60,7 +60,7 @@ public class ByteEchoPeerHandler extends SimpleChannelInboundHandler<ByteBuf> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, ByteBuf buf) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, ByteBuf buf) throws Exception {
|
||||
meter.mark(buf.readableBytes());
|
||||
|
||||
ctx.write(buf);
|
||||
|
@ -49,7 +49,7 @@ public class UptimeClientHandler extends SimpleChannelInboundHandler<Object> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
// Discard received data
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ public class WorldClockClientHandler extends SimpleChannelInboundHandler<LocalTi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, LocalTimes times) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, LocalTimes times) throws Exception {
|
||||
answer.add(times);
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class WorldClockServerHandler extends SimpleChannelInboundHandler<Locatio
|
||||
WorldClockServerHandler.class.getName());
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, Locations locations) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, Locations locations) throws Exception {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
|
||||
LocalTimes.Builder builder = LocalTimes.newBuilder();
|
||||
|
@ -149,7 +149,7 @@ public class SctpEchoTest extends AbstractSctpTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
byte[] actual = new byte[in.readableBytes()];
|
||||
in.readBytes(actual);
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class DatagramMulticastTest extends AbstractDatagramTest {
|
||||
|
||||
sb.handler(new SimpleChannelInboundHandler<Object>() {
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
// Nothing will be sent.
|
||||
}
|
||||
});
|
||||
@ -97,7 +97,7 @@ public class DatagramMulticastTest extends AbstractDatagramTest {
|
||||
private volatile boolean fail;
|
||||
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
|
||||
protected void messageReceived(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
|
||||
if (done) {
|
||||
fail = true;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class DatagramUnicastTest extends AbstractDatagramTest {
|
||||
|
||||
sb.handler(new SimpleChannelInboundHandler<DatagramPacket>() {
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
|
||||
assertEquals(1, msg.content().readInt());
|
||||
latch.countDown();
|
||||
}
|
||||
@ -49,7 +49,7 @@ public class DatagramUnicastTest extends AbstractDatagramTest {
|
||||
|
||||
cb.handler(new SimpleChannelInboundHandler<Object>() {
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, Object msgs) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, Object msgs) throws Exception {
|
||||
// Nothing will be sent.
|
||||
}
|
||||
});
|
||||
@ -69,12 +69,13 @@ public class DatagramUnicastTest extends AbstractDatagramTest {
|
||||
run();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testSimpleSendWithoutBind(Bootstrap sb, Bootstrap cb) throws Throwable {
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
sb.handler(new SimpleChannelInboundHandler<DatagramPacket>() {
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
|
||||
assertEquals(1, msg.content().readInt());
|
||||
latch.countDown();
|
||||
}
|
||||
@ -82,7 +83,7 @@ public class DatagramUnicastTest extends AbstractDatagramTest {
|
||||
|
||||
cb.handler(new SimpleChannelInboundHandler<Object>() {
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, Object msgs) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, Object msgs) throws Exception {
|
||||
// Nothing will be sent.
|
||||
}
|
||||
});
|
||||
|
@ -96,7 +96,7 @@ public class SocketBufReleaseTest extends AbstractSocketTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
// discard
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ public class SocketEchoTest extends AbstractSocketTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
byte[] actual = new byte[in.readableBytes()];
|
||||
in.readBytes(actual);
|
||||
|
||||
|
@ -72,7 +72,7 @@ public class SocketFileRegionTest extends AbstractSocketTest {
|
||||
|
||||
ChannelInboundHandler ch = new SimpleChannelInboundHandler<Object>() {
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -131,7 +131,7 @@ public class SocketFileRegionTest extends AbstractSocketTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
byte[] actual = new byte[in.readableBytes()];
|
||||
in.readBytes(actual);
|
||||
|
||||
|
@ -134,7 +134,7 @@ public class SocketFixedLengthEchoTest extends AbstractSocketTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
|
||||
assertEquals(1024, msg.readableBytes());
|
||||
|
||||
byte[] actual = new byte[msg.readableBytes()];
|
||||
|
@ -132,7 +132,7 @@ public class SocketGatheringWriteTest extends AbstractSocketTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
counter += in.readableBytes();
|
||||
received.writeBytes(in);
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class SocketShutdownOutputByPeerTest extends AbstractServerSocketTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
|
||||
queue.offer(msg.readByte());
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class SocketShutdownOutputBySelfTest extends AbstractClientSocketTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
|
||||
queue.offer(msg.readByte());
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ public class SocketSpdyEchoTest extends AbstractSocketTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
byte[] actual = new byte[in.readableBytes()];
|
||||
in.readBytes(actual);
|
||||
|
||||
|
@ -205,7 +205,7 @@ public class SocketSslEchoTest extends AbstractSocketTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
byte[] actual = new byte[in.readableBytes()];
|
||||
in.readBytes(actual);
|
||||
|
||||
|
@ -159,7 +159,7 @@ public class SocketStartTlsTest extends AbstractSocketTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||
if ("StartTlsResponse".equals(msg)) {
|
||||
ctx.pipeline().addAfter("logger", "ssl", sslHandler);
|
||||
handshakeFuture = sslHandler.handshakeFuture();
|
||||
@ -201,7 +201,7 @@ public class SocketStartTlsTest extends AbstractSocketTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||
if ("StartTlsRequest".equals(msg)) {
|
||||
ctx.pipeline().addAfter("logger", "ssl", sslHandler);
|
||||
ctx.writeAndFlush("StartTlsResponse\n");
|
||||
|
@ -146,7 +146,7 @@ public class SocketStringEchoTest extends AbstractSocketTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||
assertEquals(data[counter], msg);
|
||||
|
||||
if (channel.parent() != null) {
|
||||
|
@ -167,7 +167,7 @@ public class UDTClientServerConnectionTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
log.info("Client received: " + msg);
|
||||
}
|
||||
}
|
||||
@ -320,7 +320,7 @@ public class UDTClientServerConnectionTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
public void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
log.info("Server received: " + msg);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import io.netty.util.internal.TypeParameterMatcher;
|
||||
* {@link SimpleChannelInboundHandler}<{@link String}> {
|
||||
*
|
||||
* {@code @Override}
|
||||
* protected void channelRead0({@link ChannelHandlerContext} ctx, {@link String} message)
|
||||
* protected void messageReceived({@link ChannelHandlerContext} ctx, {@link String} message)
|
||||
* throws {@link Exception} {
|
||||
* System.out.println(message);
|
||||
* }
|
||||
@ -37,6 +37,11 @@ import io.netty.util.internal.TypeParameterMatcher;
|
||||
*
|
||||
* Be aware that depending of the constructor parameters it will release all handled messages.
|
||||
*
|
||||
* <h3>Backward compatibility consideration</h3>
|
||||
* <p>
|
||||
* Since 5.0, {@code channelRead0(ChannelHandlerContext, I)} has been renamed to
|
||||
* {@link #messageReceived(ChannelHandlerContext, Object)}.
|
||||
* </p>
|
||||
*/
|
||||
public abstract class SimpleChannelInboundHandler<I> extends ChannelInboundHandlerAdapter {
|
||||
|
||||
@ -95,7 +100,7 @@ public abstract class SimpleChannelInboundHandler<I> extends ChannelInboundHandl
|
||||
if (acceptInboundMessage(msg)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
I imsg = (I) msg;
|
||||
channelRead0(ctx, imsg);
|
||||
messageReceived(ctx, imsg);
|
||||
} else {
|
||||
release = false;
|
||||
ctx.fireChannelRead(msg);
|
||||
@ -115,5 +120,5 @@ public abstract class SimpleChannelInboundHandler<I> extends ChannelInboundHandl
|
||||
* @param msg the message to handle
|
||||
* @throws Exception is thrown if an error occurred
|
||||
*/
|
||||
protected abstract void channelRead0(ChannelHandlerContext ctx, I msg) throws Exception;
|
||||
protected abstract void messageReceived(ChannelHandlerContext ctx, I msg) throws Exception;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user