ZMQ.Event event;
Socket helper = context.socket(ZMQ.REP);
int port = helper.bindToRandomPort("tcp://127.0.0.1");
Socket socket = context.socket(ZMQ.REP);
Socket monitor = context.socket(ZMQ.PAIR);
monitor.setReceiveTimeOut(100);
assertTrue(socket.monitor("inproc://monitor.socket", ZMQ.EVENT_BIND_FAILED));
monitor.connect("inproc://monitor.socket");