add unit tests for Message encode and decode