code: private void setProtocols(String protocolsString, boolean append) {
      List<Protocol> protocolsList = new ArrayList<>();
      if (append) {
        protocolsList.addAll(client.getProtocols());
      }
      for (String protocol : protocolsString.split(",", -1)) {
        try {
          protocolsList.add(Protocol.get(protocol));
        } catch (IOException e) {
          throw new IllegalStateException(e);
        }
      }
      client.setProtocols(protocolsList);
    }
docs: /*
  Splits and validates a comma-separated string of protocols.
  When append == false, we require that the transport list contains "http/1.1".
  Throws {@link IllegalStateException} when one of the protocols isn't
  defined in {@link Protocol OkHttp's protocol enumeration}.