adding more test casses into encode and decode, however it seems to be the behavior for encode is not consistent, may need to refactor the code for message or frame or both