public static void BodyParseSerializeTest(string[] args) { BodyParser parser = new BodyParser(); BodySerializer serial = new BodySerializer(); serial.Pipe(parser); serial.OnFail += () => Console.WriteLine("serializer failed"); parser.OnData += (data) => Console.WriteLine(UTF8.GetString(data)); parser.OnFinish += () => Console.WriteLine("parser finished"); parser.Excess.Pipe(VoidWritable.Default); BodyType bodyType = new BodyType(null, TransferEncoding.Chunked, TransferCompression.Deflate); if (!parser.TrySetFor(bodyType)) { Console.WriteLine("parser failed to set"); } if (!serial.TrySetFor(bodyType)) { Console.WriteLine("serializer failed to set"); } serial.Write(UTF8.GetBytes("I am a body\r\nxd\r\n")); serial.Write(UTF8.GetBytes("I am a body\r\nasfjaskfd\r\nasdfa")); serial.Finish(); Console.ReadKey(); }