@Test
  public void testHashtableObject() throws Exception {
    Random random = getRandom();
    Hashtable<Long, String> map = new Hashtable<>();
    int size = random.nextInt(50);
    for (int i = 0; i < size; i++) {
      Long key = random.nextLong();
      String value = String.valueOf(random.nextLong());
      map.put(key, value);
    }

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

    DataInput in = getDataInput();
    Hashtable<Long, String> map2 = DataSerializer.readObject(in);
    assertEquals(map, map2);
  }
Tests data serializing an {@link Hashtable} using {@link DataSerializer#writeObject}.
geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java