Move message encode/decode to utility class

- New MessageCodec class
- Also remove all import foo.* in non-test code.

Refs Issue #4