code: public static void shutdownStandalone(final ModelControllerClient client, final int timeout) throws IOException {
          final ModelNode op = Operations.createOperation("shutdown");
          op.get("timeout").set(timeout);
          final ModelNode response = client.execute(op);
          if (Operations.isSuccessfulOutcome(response)) {
              while (true) {
                  if (isStandaloneRunning(client)) {
                      try {
                          TimeUnit.MILLISECONDS.sleep(20L);
                      } catch (InterruptedException e) {
                          LOGGER.trace("Interrupted during sleep", e);
                      }
                  } else {
                      break;
                  }
              }
          } else {
              throw new OperationExecutionException(op, response);
          }
      }
docs: Shuts down a standalone server.
  
  @param client  the client used to communicate with the server
  @param timeout the graceful shutdown timeout, a value of {@code -1} will wait indefinitely and a value of
  {@code 0} will not attempt a graceful shutdown
  
  @throws IOException if an error occurs communicating with the server