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[] smile = SmileIOUtil.toByteArray(
                ProtobufIOUtil.newPipe(protobuf, 0, protobuf.length), pipeSchema, false);

        byte[] smileFromStream = SmileIOUtil.toByteArray(
                ProtobufIOUtil.newPipe(protobufStream), pipeSchema, false);

        assertTrue(Arrays.equals(smile, smileFromStream));

        T parsedMessage = schema.newMessage();
        SmileIOUtil.mergeFrom(smile, parsedMessage, schema, false);
        SerializableObjects.assertEquals(message, parsedMessage);

        ByteArrayInputStream smileStream = new ByteArrayInputStream(smile);

        byte[] protobufRoundTrip = ProtobufIOUtil.toByteArray(
                SmileIOUtil.newPipe(smile, 0, smile.length, false), pipeSchema, buf());

        byte[] protobufRoundTripFromStream = ProtobufIOUtil.toByteArray(
                SmileIOUtil.newPipe(smileStream, false), pipeSchema, buf());

        assertTrue(Arrays.equals(protobufRoundTrip, protobufRoundTripFromStream));

        assertTrue(Arrays.equals(protobufRoundTrip, protobuf));
    }
Test case for smile pipes.

@author David Yu
@created Feb 11, 2011
protostuff-json/src/test/java/io/protostuff/SmilePipeTest.java