ZContext ctx = new ZContext();
ZThread.fork(ctx, new Publisher());
ZThread.fork(ctx, new Subscriber());
Socket subscriber = ctx.createSocket(ZMQ.XSUB);
subscriber.connect("tcp://localhost:6000");
Socket publisher = ctx.createSocket(ZMQ.XPUB);
publisher.bind("tcp://*:6001");
Socket listener = ZThread.fork(ctx, new Listener());
ZMQ.proxy (subscriber, publisher, listener);