code: private static String getGateway(DiscordApiImpl api) {
          gatewayReadLock.lock();
          if (gateway == null) {
              gatewayReadLock.unlock();
              gatewayWriteLock.lock();
              try {
                  if (gateway == null) {
                      gateway = new RestRequest<String>(api, RestMethod.GET, RestEndpoint.GATEWAY)
                              .includeAuthorizationHeader(false)
                              .execute(result -> result.getJsonBody().get("url").asText())
                              .join();
                  }
                  gatewayReadLock.lock();
              } finally {
                  gatewayWriteLock.unlock();
              }
          }
  
          try {
              return gateway;
          } finally {
              gatewayReadLock.unlock();
          }
      }
docs: Gets the gateway used to connect.
  If no gateway was requested or set so far, it will request one from Discord.
  
  @param api The api used to make the rest call.
  @return The gateway url as string.