Fix "keys" message parsing

Add encoding and decoding tests
Merge pull request #9 from cachapa/master

Fix "keys" message parsing