unit test for the whole serialization process

Interface Input DataInput anf DataOutput need to be revised, but I left them unchanged
it has to be called after method initialize. we can add a static overload of it by adding some arguments.