@Override
  public ProjectRepositories load(String projectKey, @Nullable String branchBase) {
    GetRequest request = new GetRequest(getUrl(projectKey, branchBase));
    try (WsResponse response = wsClient.call(request)) {
      try (InputStream is = response.contentStream()) {
        return processStream(is);
      } catch (IOException e) {
        throw new IllegalStateException("Couldn't load project repository for " + projectKey, e);
      }
    } catch (RuntimeException e) {
      if (shouldThrow(e)) {
        throw e;
      }

      LOG.debug("Project repository not available - continuing without it");
      return new SingleProjectRepository();
    }
  }
@Test(expected = IllegalStateException.class)
  public void parsingError() throws IOException {
    InputStream is = mock(InputStream.class);
    when(is.read(any(byte[].class), anyInt(), anyInt())).thenThrow(IOException.class);
    WsTestUtil.mockStream(wsClient, "/batch/project.protobuf?key=foo%3F", is);
    loader.load(PROJECT_KEY, null);
  }