public void testDataInputStreamDecoding() throws Exception
    {
        // Unfortuneatley, DataInputStream uses Modified UTF-8,
        // which does not support 4-byte characters, as used in the
        // 'Standard UTF-8'. This is a sacrifice of generating
        // standard conformant UTF-8 Strings.
        //
        // Note: this only happens for surrogate pairs (e.g. emoji's)
        LinkedBuffer lb = new LinkedBuffer(256);
        WriteSession session = new WriteSession(lb);
        StringSerializer.writeUTF8FixedDelimited(surrogatePairs, session, lb);

        byte[] buffered = session.toByteArray();

        ByteArrayInputStream in = new ByteArrayInputStream(buffered);
        DataInputStream din = new DataInputStream(in);

        try
        {
            String dinResult = din.readUTF();
            fail();
        }
        catch (IOException ex)
        {
            // Decoding failed of 4-byte format.
        }
    }
Tests for UTF-8 Encoding

@author David Yu
@created Jul 6, 2010
protostuff-api/src/test/java/io/protostuff/StringSerializerTest.java