Assert message is packed properly

Added test harness.  Moved beacon to module, as a side effect this fixed
the mutability of variables when code was moved around in the file.  The
test harness needs to be moved into clear methods and consider use of a
test runner like mocha.