code: private void runDelegatedTasks(SSLEngine engine) throws Exception {
  
              Runnable runnable;
              while ((runnable = engine.getDelegatedTask()) != null) {
                  logger.debug("\trunning delegated task...");
                  runnable.run();
              }
              SSLEngineResult.HandshakeStatus hsStatus =
                      engine.getHandshakeStatus();
              if (hsStatus == SSLEngineResult.HandshakeStatus.NEED_TASK) {
                  throw new Exception(
                          "handshake shouldn't need additional tasks");
              }
              logger.debug("\tnew HandshakeStatus: " + hsStatus);
      }
docs: /*
  If the result indicates that we have outstanding tasks to do,
  go ahead and run them in this thread.