public int tryConnect() throws IOException {
    return connect(request -> {
      URLConnection connection = request.getConnection();
      return connection instanceof HttpURLConnection ? ((HttpURLConnection)connection).getResponseCode() : -1;
    });
  }
public int tryConnect()