Program: 72305
Project: 72305
Buggy source:
@Override protected void channelRead0(ChannelHandlerContext ctx,BasePackage msg) throws Exception {
  try {
switch (msg.getMsgType()) {
case BasePackage.HEART_BEAT:
      log.debug("String_Node_Str" + ctx.channel().id().asShortText());
    ctx.channel().writeAndFlush(msg);
  break;
case BasePackage.INITIAL_REQUEST:
log.debug("String_Node_Str" + ctx.channel().id().asShortText());
synchronized (this) {
InitialRequestPackage requestMsg=(InitialRequestPackage)msg;
if (CollectionUtils.isEmpty(requestMsg.getContextNames())) {
  ctx.close();
  break;
}
log.info(String.format("String_Node_Str",requestMsg.getClientName(),StringUtils.join(requestMsg.getContextNames(),"String_Node_Str")));
if (clientSession == null) {
  clientSession=new ClientSession(requestMsg.getClientName(),ctx.channel());
}
 else {
  clientSession.setClientChannel(ctx.channel());
}
requestMsg.getContextNames().stream().forEach((contextName) -> {
  if (!oneNetServer.getContexts().containsKey(contextName)) {
    ctx.channel().writeAndFlush(new MessagePackage(String.format("String_Node_Str",contextName)));
  }
 else {
    OneNetServerContextConfig config=oneNetServer.getContexts().get(contextName).getOneNetServerContextConfig();
    ctx.channel().writeAndFlush(new InitialResponsePackage(contextName,config.isZip(),config.isAes(),config.getKBps()));
    oneNetServer.getOneNetTcpConnectionManager().registerClientSession(contextName,clientSession);
  }
}
);
}
break;
case BasePackage.INVALID_SESSION:
log.debug("String_Node_Str" + ctx.channel().id().asShortText());
OneNetServerContext oneNetServerContext=oneNetServer.getContexts().get(msg.getContextName());
if (oneNetServerContext != null) {
oneNetServerContext.close(msg.getSessionId());
}
break;
case BasePackage.DATA:
log.debug("String_Node_Str" + ctx.channel().id().asShortText());
oneNetServerContext=oneNetServer.getContexts().get(msg.getContextName());
if (oneNetServerContext == null) {
return;
}
;
OneNetSession oneNetSession=oneNetServerContext.getOneNetSessions().get(msg.getSessionId());
if (oneNetSession != null) {
DataPackage dataPackage=(DataPackage)msg;
byte[] outputData=dataPackage.getRawData();
oneNetSession.getInternetChannel().writeAndFlush(outputData);
}
 else {
if (oneNetSession.getClientSession() != null && oneNetSession.getClientSession().getClientChannel() != null) {
oneNetSession.getClientSession().getClientChannel().writeAndFlush(new InvalidSessionPackage(msg.getContextName(),msg.getSessionId()));
log.info("String_Node_Str" + msg.getSessionId());
}
}
}
}
 catch (Exception ex) {
ex.printStackTrace();
}
}

Fixed version (ground truth):
@Override protected void channelRead0(ChannelHandlerContext ctx,BasePackage msg) throws Exception {
  try {
switch (msg.getMsgType()) {
case BasePackage.HEART_BEAT:
      log.debug("String_Node_Str" + ctx.channel().id().asShortText());
    ctx.channel().writeAndFlush(msg);
  this.clientSession.setLastHeartBeatTime(new Date());
break;
case BasePackage.INITIAL_REQUEST:
log.debug("String_Node_Str" + ctx.channel().id().asShortText());
synchronized (this) {
InitialRequestPackage requestMsg=(InitialRequestPackage)msg;
if (CollectionUtils.isEmpty(requestMsg.getContextNames())) {
ctx.close();
break;
}
log.info(String.format("String_Node_Str",requestMsg.getClientName(),StringUtils.join(requestMsg.getContextNames(),"String_Node_Str")));
clientSession=new ClientSession(requestMsg.getClientName(),ctx.channel(),new Date());
requestMsg.getContextNames().stream().forEach((contextName) -> {
if (!oneNetServer.getContexts().containsKey(contextName)) {
  ctx.channel().writeAndFlush(new MessagePackage(String.format("String_Node_Str",contextName)));
}
 else {
  OneNetServerContextConfig config=oneNetServer.getContexts().get(contextName).getOneNetServerContextConfig();
  ctx.channel().writeAndFlush(new InitialResponsePackage(contextName,config.isZip(),config.isAes(),config.getKBps()));
  oneNetServer.getOneNetTcpConnectionManager().registerClientSession(contextName,requestMsg.getClientName(),clientSession);
}
}
);
}
break;
case BasePackage.INVALID_SESSION:
log.debug("String_Node_Str" + ctx.channel().id().asShortText());
OneNetServerContext oneNetServerContext=oneNetServer.getContexts().get(msg.getContextName());
if (oneNetServerContext != null) {
oneNetServerContext.close(msg.getSessionId());
}
break;
case BasePackage.DATA:
log.debug("String_Node_Str" + ctx.channel().id().asShortText());
oneNetServerContext=oneNetServer.getContexts().get(msg.getContextName());
if (oneNetServerContext == null) {
return;
}
;
OneNetSession oneNetSession=oneNetServerContext.getOneNetSessions().get(msg.getSessionId());
if (oneNetSession != null) {
DataPackage dataPackage=(DataPackage)msg;
byte[] outputData=dataPackage.getRawData();
oneNetSession.getInternetChannel().writeAndFlush(outputData);
}
 else {
if (oneNetSession.getClientSession() != null && oneNetSession.getClientSession().getClientChannel() != null) {
oneNetSession.getClientSession().getClientChannel().writeAndFlush(new InvalidSessionPackage(msg.getContextName(),msg.getSessionId()));
log.info("String_Node_Str" + msg.getSessionId());
}
}
}
}
 catch (Exception ex) {
ex.printStackTrace();
}
}