p2p: fix decoding of disconnect reason

Fixes #200. ~~There will be a test in a later PR.~~ A test is included.

This also adds `MsgPipe`, which is useful for protocol testing.

:yum: