code: private void validateUpgrade(StatusLine statusLine, Map<String, List<String>> headers) throws WebSocketException
      {
          // Get the values of Upgrade.
          List<String> values = headers.get("Upgrade");
  
          if (values == null || values.size() == 0)
          {
              // The opening handshake response does not contain 'Upgrade' header.
              throw new OpeningHandshakeException(
                  WebSocketError.NO_UPGRADE_HEADER,
                  "The opening handshake response does not contain 'Upgrade' header.",
                  statusLine, headers);
          }
  
          for (String value : values)
          {
              // Split the value of Upgrade header into elements.
              String[] elements = value.split("\\s*,\\s*");
  
              for (String element : elements)
              {
                  if ("websocket".equalsIgnoreCase(element))
                  {
                      // Found 'websocket' in Upgrade header.
                      return;
                  }
              }
          }
  
          // 'websocket' was not found in 'Upgrade' header.
          throw new OpeningHandshakeException(
              WebSocketError.NO_WEBSOCKET_IN_UPGRADE_HEADER,
              "'websocket' was not found in 'Upgrade' header.",
              statusLine, headers);
      }
docs: Validate the value of {@code Upgrade} header.
  
  <blockquote>
  <p>From RFC 6455, p19.</p>
  <p><i>
  If the response lacks an {@code Upgrade} header field or the {@code Upgrade}
  header field contains a value that is not an ASCII case-insensitive match for
  the value "websocket", the client MUST Fail the WebSocket Connection.
  </i></p>
  </blockquote>