Better tests and logging

This fixes issue #7 and lets us test outgoing messages without actually sending them.