private void OnCloseTag(Close close)
        {
            connection.Dispose();
            connection = null;

            throw new IOException("Connection was closed by the server");
        }
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    cts.Cancel();
                    cts.Dispose();

                    dataStream.Dispose();

                    state = ProcessingState.MCS_VERSION_TAG_AND_SIZE;

                    if (connection != null)
                    {
                        connection.DataReceived -= Connection_DataReceived;
                        connection.Dispose();
                        connection = null;
                    }
                }

                disposedValue = true;
            }
        }
 internal FcmListener(IFcmConnection connection)
 {
     this.connection = connection;
 }
        private bool disposedValue = false; // To detect redundant calls

        public FcmListener()
        {
            connection = new FcmConnection();
        }