private void TcpClientAcceptCallback(IAsyncResult asyncResult)
        {
            if (_closing)
            {
                return;
            }

            DoBeginListenForClients();

            try
            {
                TcpClient client = _tcpListener.EndAcceptTcpClient(asyncResult);

                TcpHost host = new TcpHost(client);
                if (_certificate != null)
                {
                    host.BeginAuthenticationAsServer(_certificate, _configuration.SslProtocols, AuthenticationCallback, host);
                }
                else
                {
                    ReadFirstPacket(host);
                }
            }
            catch (IOException)
            {
                // TCP Listener may not be valid anymore
            }
        }
        private void TcpClientAcceptCallback(IAsyncResult asyncResult)
        {
            if (_closing)
                return;

            DoBeginListenForClients();

            try
            {
                TcpClient client = _tcpListener.EndAcceptTcpClient(asyncResult);

                TcpHost host = new TcpHost(client);
                if (_certificate != null)
                {
                    host.BeginAuthenticationAsServer(_certificate, _configuration.SslProtocols, AuthenticationCallback, host);
                }
                else
                {
                    ReadFirstPacket(host);
                }
            }
            catch (IOException)
            {
                // TCP Listener may not be valid anymore
            }
        }