final String QUOTED = "\\\"quo\\\\ted\\\"";
SerializableString sstr = new SerializedString(INPUT);
// sanity checks first:
assertEquals(sstr.getValue(), INPUT);
assertEquals(QUOTED, new String(sstr.asQuotedChars()));
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
assertEquals(QUOTED.length(), sstr.writeQuotedUTF8(bytes));
assertEquals(QUOTED, bytes.toString("UTF-8"));
bytes.reset();