code: public void deliver(final byte[] message) {
      synchronized (this.heartBeatManager) {
        if (this.currentStatus.isNotRunning()) {
          LOG.log(Level.WARNING,
              "Trying to send a message to a task that is in state: {0}. Ignoring.",
              this.currentStatus.getState());
        } else {
          try {
            this.deliverMessageToTask(message);
          } catch (final TaskMessageHandlerFailure taskMessageHandlerFailure) {
            LOG.log(Level.WARNING, "Exception while executing task close handler.",
                taskMessageHandlerFailure.getCause());
            this.currentStatus.setException(taskMessageHandlerFailure.getCause());
          }
        }
      }
    }
docs: Deliver a message to the Task. This calls into the user supplied message handler.
  
  @param message the message to be delivered.