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

        ByteArrayInputStream protobufStream = new ByteArrayInputStream(protobuf);

        byte[] json = JsonIOUtil.toByteArray(
                ProtobufIOUtil.newPipe(protobuf, 0, protobuf.length), pipeSchema, numeric);

        byte[] jsonFromStream = JsonIOUtil.toByteArray(
                ProtobufIOUtil.newPipe(protobufStream), pipeSchema, numeric);

        assertTrue(json.length == jsonFromStream.length);
        assertEquals(STRING.deser(json), STRING.deser(jsonFromStream));

        T parsedMessage = schema.newMessage();
        JsonIOUtil.mergeFrom(json, parsedMessage, schema, numeric);
        SerializableObjects.assertEquals(message, parsedMessage);

        ByteArrayInputStream jsonStream = new ByteArrayInputStream(json);

        byte[] protobufRoundTrip = ProtobufIOUtil.toByteArray(
                JsonIOUtil.newPipe(json, 0, json.length, numeric), pipeSchema, buf());

        byte[] protobufRoundTripFromStream = ProtobufIOUtil.toByteArray(
                JsonIOUtil.newPipe(jsonStream, numeric), pipeSchema, buf());

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

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

        checkCompat(json, jsonFromStream, protobuf, pipeSchema, numeric, false);
    }
Test case for json pipes.

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