Add rule validation on message encoding.
Merge pull request #7 from kevinburg/master

Rule validation on message encoding