public ProjectList getProjects(String serverUrl, String token) {
    HttpUrl url = buildUrl(serverUrl, "/rest/api/1.0/projects");
    return doGet(token, url, body -> buildGson().fromJson(body, ProjectList.class));
  }
@Test
  public void get_projects_failed() {
    server.enqueue(new MockResponse()
          .setBody(new Buffer().write(new byte[4096]))
          .setSocketPolicy(SocketPolicy.DISCONNECT_DURING_RESPONSE_BODY));

    String serverUrl = server.url("/").toString();
    assertThatThrownBy(() -> underTest.getProjects(serverUrl, "token"))
            .isInstanceOf(IllegalArgumentException.class)
            .hasMessage("Unable to contact Bitbucket server");

    assertThat(String.join(", ", logTester.logs())).contains("Unable to contact Bitbucket server");
  }