docs: private void validateExtensions(StatusLine statusLine, Map<String, List<String>> headers) throws WebSocketException
      {
          // Get the values of Sec-WebSocket-Extensions.
          List<String> values = headers.get("Sec-WebSocket-Extensions");
  
          if (values == null || values.size() == 0)
          {
              // Nothing to check.
              return;
          }
  
          List<WebSocketExtension> extensions = new ArrayList<WebSocketExtension>();
  
          for (String value : values)
          {
              // Split the value into elements each of which represents an extension.
              String[] elements = value.split("\\s*,\\s*");
  
              for (String element : elements)
              {
                  // Parse the string whose format is supposed to be "{name}[; {key}[={value}]*".
                  WebSocketExtension extension = WebSocketExtension.parse(element);
  
                  if (extension == null)
                  {
                      // The value in 'Sec-WebSocket-Extensions' failed to be parsed.
                      throw new OpeningHandshakeException(
                          WebSocketError.EXTENSION_PARSE_ERROR,
                          "The value in 'Sec-WebSocket-Extensions' failed to be parsed: " + element,
                          statusLine, headers);
                  }
  
                  // The extension name.
                  String name = extension.getName();
  
                  // If the extension is not contained in the original request from this client.
                  if (mWebSocket.getHandshakeBuilder().containsExtension(name) == false)
                  {
                      // The extension contained in the Sec-WebSocket-Extensions header is not supported.
                      throw new OpeningHandshakeException(
                          WebSocketError.UNSUPPORTED_EXTENSION,
                          "The extension contained in the Sec-WebSocket-Extensions header is not supported: " + name,
                          statusLine, headers);
                  }
  
                  // Let the extension validate itself.
                  extension.validate();
  
                  // The extension has been agreed.
                  extensions.add(extension);
              }
          }
  
          // Check if extensions conflict with each other.
          validateExtensionCombination(statusLine, headers, extensions);
  
          // Agreed extensions.
          mWebSocket.setAgreedExtensions(extensions);
      }