code: private void sendErrorMessage(StatusCodes code) {
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
              Tr.debug(tc, "Sending an error page back [code: " + code + "]");
          }
          try {
              getHTTPContext().sendError(code.getHttpError());
          } catch (MessageSentException mse) {
              // no FFDC required
              close(getVirtualConnection(), new Exception("HTTP Message failure"));
          }
      }
docs: Send an error message back to the client with a defined
  status code, instead of an exception.
  
  @param code