code: public WebSocket createSocket(URL url, int timeout) throws IOException
      {
          if (url == null)
          {
              throw new IllegalArgumentException("The given URL is null.");
          }
  
          if (timeout < 0)
          {
              throw new IllegalArgumentException("The given timeout value is negative.");
          }
  
          try
          {
              return createSocket(url.toURI(), timeout);
          }
          catch (URISyntaxException e)
          {
              throw new IllegalArgumentException("Failed to convert the given URL into a URI.");
          }
      }
docs: Create a WebSocket.
  
  <p>
  This method is an alias of {@link #createSocket(URI, int) createSocket}{@code
  (url.}{@link URL#toURI() toURI()}{@code , timeout)}.
  </p>
  
  @param url
  The URL of the WebSocket endpoint on the server side.
  
  @param timeout
  The timeout value in milliseconds for socket connection.
  
  @return
  A WebSocket.
  
  @throws IllegalArgumentException
  The given URL is {@code null} or failed to be converted into a URI,
  or the given timeout value is negative.
  
  @throws IOException
  Failed to create a socket. Or, HTTP proxy handshake or SSL
  handshake failed.
  
  @since 1.10