Program: 12412
Project: 12412
Buggy source:
private Connection buildConnection(ChannelHandlerContext ctx,PBAPNSEvent pbapnsEvent){
  Connection conn=ConnectionKeeper.get(pbapnsEvent.getAppKey(),pbapnsEvent.getUserId());
  boolean newOne=true;
  if (null != conn) {
    if (!conn.getDeviceId().equalsIgnoreCase(pbapnsEvent.getDeviceId())) {
      ConnectionKeeper.remove(pbapnsEvent.getAppKey(),pbapnsEvent.getUserId());
      logger.error("String_Node_Str",ctx,conn);
      ack(ctx,conn,pbapnsEvent,MULTI_CLIENTS);
      newOne=true;
    }
 else     if (conn.getContext().channel().hashCode() != ctx.channel().hashCode()) {
      InetSocketAddress ip=(InetSocketAddress)conn.getContext().channel().remoteAddress();
      InetSocketAddress ip2=(InetSocketAddress)ctx.channel().remoteAddress();
      if (ip.getAddress().getHostAddress().equalsIgnoreCase(ip2.getAddress().getHostAddress())) {
        if (pbapnsEvent.getOp() == PBAPNSEvent.Ops.Online_VALUE) {
          logger.warn("String_Node_Str",ip,ip);
          ack(ctx,conn,pbapnsEvent,MULTI_CLIENTS);
          newOne=true;
        }
 else {
          ConnectionKeeper.remove(pbapnsEvent.getAppKey(),pbapnsEvent.getUserId());
          newOne=true;
        }
      }
 else {
        logger.warn("String_Node_Str",ip,ip2);
        ConnectionKeeper.remove(pbapnsEvent.getAppKey(),pbapnsEvent.getUserId());
        newOne=true;
      }
    }
 else {
      newOne=false;
      conn.setStatusId(ClientStatus.Online);
    }
  }
  if (newOne) {
    logger.debug("String_Node_Str",pbapnsEvent.getUserId(),ctx.channel().remoteAddress());
    conn=new Connection(ctx);
    conn.setUserId(pbapnsEvent.getUserId());
    conn.setAppKey(pbapnsEvent.getAppKey());
    conn.setDeviceId(pbapnsEvent.getDeviceId());
    ConnectionKeeper.add(pbapnsEvent.getAppKey(),pbapnsEvent.getUserId(),conn);
  }
  return conn;
}

Fixed version (ground truth):
private Connection buildConnection(ChannelHandlerContext ctx,PBAPNSEvent pbapnsEvent){
  Connection conn=ConnectionKeeper.get(pbapnsEvent.getAppKey(),pbapnsEvent.getUserId());
  boolean newOne=true;
  if (null != conn) {
    if (!conn.getDeviceId().equalsIgnoreCase(pbapnsEvent.getDeviceId())) {
      ConnectionKeeper.remove(pbapnsEvent.getAppKey(),pbapnsEvent.getUserId());
      logger.error("String_Node_Str",ctx,conn);
      ack(ctx,conn,pbapnsEvent,MULTI_CLIENTS);
      newOne=true;
    }
 else     if (conn.getContext().channel().hashCode() != ctx.channel().hashCode()) {
      InetSocketAddress ip=(InetSocketAddress)conn.getContext().channel().remoteAddress();
      InetSocketAddress ip2=(InetSocketAddress)ctx.channel().remoteAddress();
      if (ip.getAddress().getHostAddress().equalsIgnoreCase(ip2.getAddress().getHostAddress())) {
        if (pbapnsEvent.getOp() == PBAPNSEvent.Ops.Online_VALUE) {
          logger.warn("String_Node_Str",ip,ip);
          ack(ctx,conn,pbapnsEvent,MULTI_CLIENTS);
          newOne=true;
        }
 else {
          ConnectionKeeper.remove(pbapnsEvent.getAppKey(),pbapnsEvent.getUserId());
          newOne=true;
        }
      }
 else {
        logger.warn("String_Node_Str",ip,ip2);
        ConnectionKeeper.remove(pbapnsEvent.getAppKey(),pbapnsEvent.getUserId());
        newOne=true;
      }
    }
 else {
      newOne=true;
      conn.setStatusId(ClientStatus.Online);
    }
  }
  if (newOne) {
    logger.debug("String_Node_Str",pbapnsEvent.getUserId(),ctx.channel().remoteAddress());
    conn=new Connection(ctx);
    conn.setUserId(pbapnsEvent.getUserId());
    conn.setAppKey(pbapnsEvent.getAppKey());
    conn.setDeviceId(pbapnsEvent.getDeviceId());
    ConnectionKeeper.add(pbapnsEvent.getAppKey(),pbapnsEvent.getUserId(),conn);
  }
  return conn;
}