code: private void manageInputBuffer(int source){
          //System.out.println(System.currentTimeMillis() + " manageInputBuffer -> "+source);
          switch (source) {
              case ControlSock:
                  //System.out.println(System.currentTimeMillis() + " - receive Control");
                  try {
                      //  Read input from socket
                      byte[] inputBuffer = controlSocket.recv(0);
                      manageControl(inputBuffer);
                      controlSocket.send("".getBytes(), 0);
                  }
                  catch (DevFailed e) {
                      controlSocket.send(e.errors[0].desc.getBytes(), 0);
                  }
                  catch (Exception e) {
                      e.printStackTrace();
                      controlSocket.send(e.toString().getBytes(), 0);
                  }
                  break;
  
              case HearBeatSock:
                  //System.out.println(System.currentTimeMillis() + " - receive heartbeat");
                  try {
                      //  Read input from socket (in 3 parts)
                      byte[][] inputs = readSocket(heartbeatSocket, 3);
                      manageHeartbeat(inputs);
                  }
                  catch (DevFailed e) {
                      Except.print_exception(e);
                  }
                  break;
  
              case EventSock:
                  //System.out.println(System.currentTimeMillis() + " - receive event  -----------------");
                  try {
                      byte[][] inputs = readSocket(eventSocket, 4);
                      manageEvent(inputs);
                  }
                  catch (DevFailed e) {
                      Except.print_exception(e);
                  }
                  break;
          }
      }
docs: ===============================================================