code: public HttpServerExchange upgradeChannel(final HttpUpgradeListener listener) {
          if (!connection.isUpgradeSupported()) {
              throw UndertowMessages.MESSAGES.upgradeNotSupported();
          }
          if(!getRequestHeaders().contains(Headers.UPGRADE)) {
              throw UndertowMessages.MESSAGES.notAnUpgradeRequest();
          }
          UndertowLogger.REQUEST_LOGGER.debugf("Upgrading request %s", this);
          connection.setUpgradeListener(listener);
          setStatusCode(StatusCodes.SWITCHING_PROTOCOLS);
          getResponseHeaders().put(Headers.CONNECTION, Headers.UPGRADE_STRING);
          return this;
      }
docs: Upgrade the channel to a raw socket. This method set the response code to 101, and then marks both the
  request and response as terminated, which means that once the current request is completed the raw channel
  can be obtained from {@link io.undertow.server.protocol.http.HttpServerConnection#getChannel()}
  
  @throws IllegalStateException if a response or upgrade was already sent, or if the request body is already being
  read