static <T> void protostuffRoundTrip(T message, Schema<T> schema,
            Pipe.Schema<T> pipeSchema) throws Exception
    {
        byte[] protostuff = ProtostuffIOUtil.toByteArray(message, schema, buf());

        ByteArrayInputStream protostuffStream = new ByteArrayInputStream(protostuff);

        byte[] xml = XmlIOUtil.toByteArray(
                ProtostuffIOUtil.newPipe(protostuff, 0, protostuff.length), pipeSchema);

        byte[] xmlFromStream = XmlIOUtil.toByteArray(
                ProtostuffIOUtil.newPipe(protostuffStream), pipeSchema);

        assertTrue(xml.length == xmlFromStream.length);
        assertEquals(STRING.deser(xml), STRING.deser(xmlFromStream));

        T parsedMessage = schema.newMessage();
        XmlIOUtil.mergeFrom(xml, parsedMessage, schema);
        SerializableObjects.assertEquals(message, parsedMessage);

        ByteArrayInputStream xmlStream = new ByteArrayInputStream(xml);

        byte[] protostuffRoundTrip = ProtostuffIOUtil.toByteArray(
                XmlIOUtil.newPipe(xml, 0, xml.length), pipeSchema, buf());

        byte[] protostuffRoundTripFromStream = ProtostuffIOUtil.toByteArray(
                XmlIOUtil.newPipe(xmlStream), pipeSchema, buf());

        assertTrue(Arrays.equals(protostuffRoundTrip, protostuffRoundTripFromStream));

        assertTrue(Arrays.equals(protostuffRoundTrip, protostuff));
    }
Test case for xml pipes.

@author David Yu
@created Oct 8, 2010
protostuff-xml/src/test/java/io/protostuff/XmlPipeTest.java