ByteArrayOutputStream bout = new ByteArrayOutputStream();
ObjectOutputStream oout = new ObjectOutputStream(bout);
oout.writeObject(new MySerializable());
oout.close();
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
Object o = new ObjectInputStream(bin).readObject();
assertTrue(o instanceof MySerializable);