@Test
public void testCanonicalUriWithPort() {

  URI uri;
  uri = NetUtils.getCanonicalUri(URI.create("scheme://host:123"), 456);
  assertEquals("scheme://host.a.b:123", uri.toString());
  uri = NetUtils.getCanonicalUri(URI.create("scheme://host:123/"), 456);
  assertEquals("scheme://host.a.b:123/", uri.toString());
  uri = NetUtils.getCanonicalUri(URI.create("scheme://host:123/path"), 456);
  assertEquals("scheme://host.a.b:123/path", uri.toString());
  uri = NetUtils.getCanonicalUri(URI.create("scheme://host:123/path?q#frag"), 456);
  assertEquals("scheme://host.a.b:123/path?q#frag", uri.toString());
}