public static Object serializeAndDeserialize( Object input ) throws Exception {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream(); // force a serialization cycle.
        final ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject( input );
        oos.flush(); oos.close();
        final ByteArrayInputStream bais = new ByteArrayInputStream( baos.toByteArray() );
        final ObjectInputStream ois = new ObjectInputStream(bais);
        return ois.readObject();
    }
Takes an object, serializes it, deserializes the resulting bytes back into an object, and returns that.

@param input The object to serialize
@return the object that was materialized again.
xmppserver/src/test/java/org/jivesoftware/openfire/pubsub/CollectionNodeTest.java