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

        ByteArrayInputStream protobufStream = new ByteArrayInputStream(protobuf);

        byte[] yaml = YamlIOUtil.toByteArray(
                ProtobufIOUtil.newPipe(protobuf, 0, protobuf.length), pipeSchema, buf());

        byte[] yamlFromStream = YamlIOUtil.toByteArray(
                ProtobufIOUtil.newPipe(protobufStream), pipeSchema, buf());

        assertTrue(yaml.length == yamlFromStream.length);

        String strYaml = STRING.deser(yaml);
        String strYamlFromStream = STRING.deser(yamlFromStream);
        assertEquals(strYaml, strYamlFromStream);
    }
Test protostuff/protobuf to yaml pipe.

@author David Yu
@created Oct 9, 2010
protostuff-yaml/src/test/java/io/protostuff/YamlPipeTest.java