TelnetClientHandler.java
736 字节
package com.waylau.netty.demo.telnet;
import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
/**
* Handles a client-side channel.
*/
@Sharable
public class TelnetClientHandler extends SimpleChannelInboundHandler<String> {
protected void messageReceived(ChannelHandlerContext ctx, String msg) {
System.err.println(msg);
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
cause.printStackTrace();
ctx.close();
}
@Override
protected void channelRead0(ChannelHandlerContext ctx, String msg)
throws Exception {
// TODO Auto-generated method stub
}
}