public static URI getProxyUri(URI originalUri, URI proxyUri,
      ApplicationId id) {
    try {
      String path = getPath(id, originalUri == null ? "/" : originalUri.getPath());
      return new URI(proxyUri.getScheme(), proxyUri.getAuthority(), path,
          originalUri == null ? null : originalUri.getQuery(),
          originalUri == null ? null : originalUri.getFragment());
    } catch (URISyntaxException e) {
      throw new RuntimeException("Could not proxy "+originalUri, e);
    }
  }
@Test
  void testGetProxyUriNull() throws Exception {
    URI originalUri = null;
    URI proxyUri = new URI("http://proxy.net:8080/");
    ApplicationId id = BuilderUtils.newApplicationId(6384623l, 5);
    URI expected = new URI("http://proxy.net:8080/proxy/application_6384623_0005/");
    URI result = ProxyUriUtils.getProxyUri(originalUri, proxyUri, id);
    assertEquals(expected, result);
  }