private FromStitchMessage Read()
        {
            var messageBuffer = _reader.ReadMessage();

            if (string.IsNullOrEmpty(messageBuffer))
            {
                return(null);
            }
            var message = _serializer.DeserializeFromStitchMessage(messageBuffer);

            return(message);
        }
 private void ReaderThreadFunction()
 {
     while (!_shouldStop)
     {
         try
         {
             var messageBuffer = _messageChannel.ReadMessage();
             if (string.IsNullOrEmpty(messageBuffer))
             {
                 continue;
             }
             var message = _serializer.DeserializeToStitchMessage(messageBuffer);
             //_incomingMessageQueue.Enqueue(message);
             _incomingMessages.Add(message);
         }
         catch (Exception e)
         {
             _incomingMessages.Add(ToStitchMessage.Error(e));
         }
     }
 }