Added zmq spec for validating assumptions.
Added assertion that server can shutdown even while waiting for a receive.
Check for errors and cleanly shutdown.