<T> void verifyOptData(byte[] optData, T message, Schema<T> schema,
            LinkedBuffer buffer) throws IOException
    {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        int size = writeDelimitedTo(out, message, schema, buf());
        int delimSize = ProtobufOutput.computeRawVarint32Size(size);
        byte[] data = out.toByteArray();

        int expectedSize = size + delimSize;
        assertEquals(expectedSize, data.length);

        // compare both outputs
        assertEquals(optData.length, data.length);

        /*
         * StringBuilder s1 = new StringBuilder(); for(int b : optData) s1.append(b).append(' ');
         * 
         * StringBuilder s2 = new StringBuilder(); for(int b : data) s2.append(b).append(' ');
         * 
         * assertEquals(s1.unsignedIntToString(), s2.unsignedIntToString());
         */

        assertTrue(Arrays.equals(optData, data));

    }
Deserializes from the byte array and data is merged/saved to the message.
protostuff-core/src/test/java/io/protostuff/DelimiterTest.java