This test hung regularly on Ubuntu 14.04, and has in particular been causing our recent Travis runs to error out due to timeouts.
This patch corrects the non-terminations of the test through the ZMQ context destruction fix added in John Newbery's Core commit 7c51e9f0dc67.
It also adapts some sections to the more recent Core version of the test, including running only 2 nodes (speeds up the test) and specifying a ZMQ socket receive timeout option.
It is the destruction of the ZMQ context that fixes the intermittent hanging problem. When the ZMQ context lingers, sys.exit(0) may not terminate the zmq_test.py program, which then causes the test runner to wait forever, which times out Travis.