public boolean reconnect(boolean needPrint, long termId) {
        long curTime = System.currentTimeMillis();
        if ((this.conFailCnt.get() >= CLIENT_FAIL_CONNECT_WAIT_CNT)
                && (curTime - lstConFailTime.get() < this.tcpConfig.getReconFailWaitMs())) {
            return false;
        }
        int curStatus = this.conStatus.get();
        if (curStatus == CLIENT_STATUS_READY) {
            return true;
        } else if (curStatus == CLIENT_STATUS_BUSY) {
            if (curTime - this.chanInvalidTime.get() < this.tcpConfig.getBusyReconnectWaitMs()) {
                return false;
            }
        } else if (curStatus == CLIENT_STATUS_FROZEN) {
            if (curTime - this.chanInvalidTime.get() < this.tcpConfig.getFrozenReconnectWaitMs()) {
                return false;
            }
        }
        rw.writeLock().lock();
        try {
            if (this.conStatus.get() == CLIENT_STATUS_READY) {
                return true;
            }
            curTime = System.currentTimeMillis();
            this.close(false);
            if (this.connect(false, termId)) {
                if (needPrint) {
                    logger.info("NettyClient({}) re-connect to {} success, wast {}ms",
                            senderId, this.channel.toString(), System.currentTimeMillis() - curTime);
                }
                return true;
            } else {
                if (needPrint) {
                    logger.info("NettyClient({}) re-connect to {} failure",
                            senderId, hostInfo.getReferenceName());
                }
                return false;
            }
        } finally {
            rw.writeLock().unlock();
        }
    }
TCP Netty client class

Used to manage TCP netty client, including connection, closing, keep-alive, sending status check, etc.
inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/network/tcp/TcpNettyClient.java