public ITcpConnection Create(ICustomTcpClient client)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            return(new TcpConnection(client, m_protocol, m_protocolHandler, m_chunkSize, m_chunkDelay, m_closeConnectionAfterResponse));
        }
        public TcpConnection(ICustomTcpClient client, IProtocol protocol,
                             IProtocolHandler protocolHandler,
                             int chunkSize = 25, int chunkDelay = 250, bool closeAfterProtocolResponse = false)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            if (protocol == null)
            {
                throw new ArgumentNullException(nameof(protocol));
            }

            if (protocolHandler == null)
            {
                throw new ArgumentNullException(nameof(protocolHandler));
            }

            if (chunkSize <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(chunkSize));
            }

            if (chunkDelay <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(chunkDelay));
            }

            Client       = client;
            m_chunkSize  = chunkSize;
            m_chunkDelay = chunkDelay;
            m_closeAfterProtocolResponse = closeAfterProtocolResponse;

            m_protocol = protocol;
            m_protocol.CommandReceived += m_protocol_CommandReceived;
            m_protocolHandler           = protocolHandler;
        }