public void testPartialSurrogatePair() throws Exception
    {
        // Make sure that we don't overflow or get out of bounds,
        // since pairs require 2 characters.
        String partial = "\uD83C";

        LinkedBuffer lb = new LinkedBuffer(256);
        WriteSession session = new WriteSession(lb);
        StringSerializer.writeUTF8(partial, session, lb);

        byte[] buffered = session.toByteArray();

        // Force the use of 'slow' path
        lb = new LinkedBuffer(1);
        session = new WriteSession(lb);
        StringSerializer.writeUTF8(partial, session, lb);

        buffered = session.toByteArray();

    }
Tests for UTF-8 Encoding

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