code: private void manageControl(byte[] messageBytes) throws DevFailed{
  
          ZMQutils.ControlStructure
                  controlStructure = ZMQutils.getInstance().decodeControlBuffer(messageBytes);
          ApiUtil.printTrace("From Control:\n" + controlStructure);
          switch (controlStructure.commandCode) {
              case ZMQutils.ZMQ_END:
                  stop = true;
                  break;
  
              case ZMQutils.ZMQ_CONNECT_HEARTBEAT:
                  connectIfNotDone(heartbeatSocket, controlStructure);
  				//System.out.println("-------> ZMQ_CONNECT_HEARTBEAT: " + controlStructure.eventName);
                  heartbeatSocket.subscribe(controlStructure.eventName.getBytes());
                  break;
  
  
              case ZMQutils.ZMQ_DISCONNECT_HEARTBEAT:
                  disconnect(heartbeatSocket, controlStructure.eventName);
                  break;
  
              case ZMQutils.ZMQ_CONNECT_EVENT:
                  connectIfNotDone(eventSocket, controlStructure);
                  eventSocket.subscribe(controlStructure.eventName.getBytes());
                  break;
  
              case ZMQutils.ZMQ_DISCONNECT_EVENT:
                  disconnect(eventSocket, controlStructure.eventName);
                  break;
  
          }
      }
docs: ===============================================================