@Override
  public synchronized List<HeliumPackage> getAll() throws IOException {
    HttpClient client = HttpClientBuilder.create()
        .setUserAgent("ApacheZeppelin/" + Util.getVersion())
        .setProxy(getProxy(uri()))
        .build();
    HttpGet get = new HttpGet(uri());
    HttpResponse response;
    try {
      if ((get.getURI().getHost().equals(zConf.getS3Endpoint()))) {
        if (zConf.getS3Timeout() != null) {
          int timeout = Integer.parseInt(zConf.getS3Timeout());
          RequestConfig requestCfg = RequestConfig.custom()
                  .setConnectTimeout(timeout)
                  .setSocketTimeout(timeout)
                  .build();
          get.setConfig(requestCfg);
        }
      }
      response = client.execute(get);
    } catch (Exception e) {
      logger.error(e.getMessage());
      return readFromCache();
    }

    if (response.getStatusLine().getStatusCode() != 200) {
      // try read from cache
      if (logger.isErrorEnabled()) {
        logger.error("{} returned {}", uri(), response.getStatusLine());
      }
      return readFromCache();
    } else {
      List<HeliumPackage> packageList = new LinkedList<>();

      BufferedReader reader;
      reader = new BufferedReader(
          new InputStreamReader(response.getEntity().getContent()));

      List<Map<String, Map<String, HeliumPackage>>> packages = gson.fromJson(
          reader,
          new TypeToken<List<Map<String, Map<String, HeliumPackage>>>>() {
          }.getType());
      reader.close();

      for (Map<String, Map<String, HeliumPackage>> pkg : packages) {
        for (Map<String, HeliumPackage> versions : pkg.values()) {
          packageList.addAll(versions.values());
        }
      }

      writeToCache(packageList);
      return packageList;
    }
  }
@Test
  void zeppelinNotebookS3TimeoutPropertyTest() throws IOException {
    ZeppelinConfiguration zConf = ZeppelinConfiguration.load();
    zConf.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_S3_TIMEOUT.getVarName(), TIMEOUT);
    zConf.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_S3_ENDPOINT.getVarName(), IP);
    HeliumOnlineRegistry heliumOnlineRegistry = new HeliumOnlineRegistry(
            "https://" + IP,
            "https://" + IP,
            tmpDir, zConf
    );

    long start = System.currentTimeMillis();
    heliumOnlineRegistry.getAll();
    long processTime = System.currentTimeMillis() - start;

    long basicTimeout = Long.valueOf(
            ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_S3_TIMEOUT.getStringValue()
    );
    assertTrue(
            basicTimeout > processTime,
            String.format(
                    "Wrong timeout during connection: expected %s, actual is about %d",
                    TIMEOUT,
                    processTime
            )
    );
  }