/// <summary> /// Converts the BaseMessage to bytes and encodes them with xor. /// </summary> /// <param name="message"></param> /// <returns></returns> private byte[] MessageToBytes(BaseMessage message) { var messageString = MessageProcessor.Build(message); var messageBytes = StringEncoding.GetBytes(messageString); Console.WriteLine("Sending >> {0}", messageString.Remove(messageString.Length - 1)); return(_encoder.Encode(messageBytes)); }