@Override
    public byte[] serialize(Object obj) throws Exception {

        UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(bos);

        try {
            oos.writeObject(obj);
            oos.flush();
            return bos.toByteArray();
        } finally {
            oos.close();
        }
    }
@author Robert HG (254963746@qq.com) on 11/6/15.
lts-core/src/main/java/com/github/ltsopensource/remoting/serialize/JavaSerializable.java