博客地址:博客地址
注意及日志输出很详细了
故不再讲解:
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.haiyang.key.Model.Socket.*;
import com.haiyang.key.Service.VersionService;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.text.SimpleDateFormat;
import java.util.Date;
//自定义的ChannelHandler
@Component
public class HelloServerHandler extends ChannelHandlerAdapter {
@Autowired
private VersionService versionService;
private static VersionService v;
private static Logger logger = Logger.getLogger(HelloServerHandler.cl