public void TestJsonNetSerialization()
		{
			var m = new FakeMessage
				{ Identifier = Guid.NewGuid(), Field2 = 3, Field1 = new List<string> { "foo", "bar", "baz" } };

			var e = new Envelope(m);

			var serializer = new JsonSerializer();

			serializer.Converters.Insert(0, new EnvelopeConverter());

			var s = JsonConvert.SerializeObject(e);

			var sr = new StringReader(s);

			var r = new JsonTextReader(sr);

			var o = serializer.Deserialize<Envelope>(r);

			Assert.AreEqual(m.GetType(), o.Payload.GetType());

			Assert.AreEqual(m.Identifier, o.Payload.Identifier);

			Assert.AreEqual(m.Field1, (o.Payload as FakeMessage).Field1);

			Assert.AreEqual(m.Field2, (o.Payload as FakeMessage).Field2);
		}
		public byte[] Serialize(IMessage source)
		{
			var envelope = new Envelope(source);

			var settings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() };

			var s = JsonConvert.SerializeObject(envelope, Formatting.None, settings);

			return Encoding.UTF8.GetBytes(s);
		}