public boolean fileExists(String path) throws IOException, InvalidTokenException {
    String url;
    try {
      url =
          getUriBuilder()
              .setPath(API_PATH_PREFIX + "/mounts/primary/files/info")
              .setParameter("path", path)
              .build()
              .toString();
    } catch (URISyntaxException e) {
      throw new IllegalStateException("Could not produce url.", e);
    }

    Request.Builder requestBuilder = getRequestBuilder(url);

    try (Response response = getResponse(requestBuilder)) {
      int code = response.code();
      if (code == 200) {
        return true;
      }
      if (code == 404) {
        return false;
      }
      throw new KoofrClientIOException(response);
    }
  }
@Test
  public void testFileExists() throws Exception {
    server.enqueue(new MockResponse().setResponseCode(200));

    boolean exists = client.fileExists("/path/to/file");
    assertTrue(exists);
    assertEquals(1, server.getRequestCount());

    final RecordedRequest recordedRequest = server.takeRequest();

    assertEquals("GET", recordedRequest.getMethod());
    assertEquals(
        "/api/v2/mounts/primary/files/info?path=%2Fpath%2Fto%2Ffile", recordedRequest.getPath());
    assertEquals("Bearer acc", recordedRequest.getHeader("Authorization"));
    assertEquals("2.1", recordedRequest.getHeader("X-Koofr-Version"));
  }