@Test
    public void testDecodePartialMultibyteString() throws Exception
    {
        final byte[] multibyteCharacter = "\u3053\u308C".getBytes(StandardCharsets.UTF_8); // two 3-byte characters.
        assert multibyteCharacter.length == 6;
        final XMLLightweightParser parser = new XMLLightweightParser();
        final ByteBuf in = ByteBufAllocator.DEFAULT.buffer(10);

        // Execute system under test.
        in.writeBytes(Arrays.copyOfRange(multibyteCharacter, 0, 5));
        final char[] result = parser.decode(in);

        // Verify results.
        assertEquals(1, result.length);
        assertEquals('\u3053', result[0]);
        assertEquals(3, in.readerIndex()); // Even though we tried to read 5 bytes, the reader index should be on the first byte after the character that was successfully read!
    }
Verifies that {@link XMLLightweightParser#decode(ByteBuf)} only reads 'enough' bytes from an input buffer that
contains multi-byte characters to make up for 'complete' characters, leaving the 'read-index' (position) of that
buffer at the position of the next, unread byte.

@see <a href="https://igniterealtime.atlassian.net/browse/OF-458">issue OF-458: XMPPDecoder has a decode problem for UTF-8</a>
@see <a href="https://igniterealtime.atlassian.net/browse/OF-2814">issue OF-2814: Issue with cyrilic (any multi-byte?) characters in messages</a>
xmppserver/src/test/java/org/jivesoftware/openfire/nio/XMLLightweightParserTest.java