@org.junit.Test public void testPrimitiveLong() throws Exception { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final ObjectOutputStream oos = new ObjectOutputStream(baos); final long input = 12345L; oos.writeLong(input); oos.close(); final InputStream bais = new ByteArrayInputStream(baos.toByteArray()); final ClassLoaderObjectInputStream clois = new ClassLoaderObjectInputStream(getClass().getClassLoader(), bais); final long result = clois.readLong(); assertEquals(input, result); clois.close(); }