Socket client = ctx.createSocket(ZMQ.REQ);
client.connect(endpoint);
// Send request, wait safely for reply
ZMsg msg = request.duplicate();
msg.send(client);
PollItem[] items = { new PollItem(client, ZMQ.Poller.POLLIN) };
ZMQ.poll(items, REQUEST_TIMEOUT);
ZMsg reply = null;
if (items[0].isReadable())
reply = ZMsg.recvMsg(client);