private async Task CheckDeadSocketAsync(ClientTcpContext <TSocketData> connection)
        {
            while (connection.Connected)
            {
                await Task.Delay(1000);

                connection.SocketStatistic.EachSecondTimer();
                var now = DateTime.UtcNow;

                var receiveInterval = now - connection.SocketStatistic.LastReceiveTime;

                if (receiveInterval > _disconnectInterval)
                {
                    var message = "Long time [" + receiveInterval +
                                  "] no received activity. Disconnecting socket " + connection.ContextName;
                    _log.InvokeInfoLog(connection, message);

                    return;
                }

                if (DateTime.UtcNow - connection.SocketStatistic.LastPingSentDateTime > PingInterval)
                {
                    connection.SocketStatistic.LastPingSentDateTime = now;
                    await connection.SendPingAsync();
                }
            }
        }
        private async Task SocketThread()
        {
            long socketId = 0;

            while (_working)
            {
                var ipEndPoints = await _getHostPort().ParseAndResolveHostPort();

                foreach (var ipEndPoint in ipEndPoints)
                {
                    try
                    {
                        CurrentTcpContext = await ConnectAsync(ipEndPoint, socketId);

                        Connected = true;
                        socketId++;

                        CurrentTcpContext.StartReadThread(_readBufferSize);

                        await CheckDeadSocketAsync(CurrentTcpContext);

                        Console.WriteLine("Here");
                        CurrentTcpContext.Disconnect();
                    }
                    catch (Exception ex)
                    {
                        _log.InvokeInfoLog(CurrentTcpContext, "Connection support exception:" + ex.Message);
                    }
                    finally
                    {
                        Connected         = false;
                        CurrentTcpContext = null;
                    }
                }

                _log.InvokeInfoLog(null, "Making reconnection timeout: " + _reconnectTimeOut.ToString("g"));
                await Task.Delay(_reconnectTimeOut);
            }
        }