ZeroMQ refactor of socket creation

Please do not merge this. This is only for exploring current issues.
These changes belong to #781, which has been merged. Care to rebase on latest `develop`?