private static <T> void assertReaderWriter(final GryoWriter writer, final GryoReader reader, final T o,
                                               final Class<T> clazz) throws Exception{
        try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
            writer.writeObject(os, o);
            os.flush();
            try (final ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray())) {
                assertEquals(o, reader.readObject(is, clazz));
            }
        }
    }
@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoPoolTest.java