@Test
  public void testStringEncodingLengthCrossesBoundry() throws Exception {
    StringBuilder sb = new StringBuilder(0xFFFF);
    for (int i = 0; i < 0xFFFF; i++) {
      if (i == 0) {
        sb.append(Character.MAX_VALUE);
      } else {
        sb.append("a");
      }
    }
    String value = sb.toString();

    DataOutputStream out = getDataOutput();
    DataSerializer.writeString(value, out);
    DataSerializer.writeObject(value, out);
    out.flush();

    DataInput in = getDataInput();
    String value2 = DataSerializer.readString(in);
    assertEquals(value, value2);
    value2 = DataSerializer.readObject(in);
    assertEquals(value, value2);
  }
Tests data serializing a non-<code>null</code> String whose length is > 0xFFFF, but who's utf-8
encoded length is < 0xFFFF See bug 40932.
geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java