### Question:
UrlUtilities { public static ThreeTuple<String, String, Integer> getProtocolHostPort(String url, int defaultPort) { int wheresTheColon = url.indexOf(':'); int hostBeginIndex = wheresTheColon + 3; String protocol = url.substring(0, wheresTheColon); int hostEndIndex = url.indexOf('/', hostBeginIndex); String host = url.substring(hostBeginIndex); if (hostEndIndex > 0) { host = host.substring(0, hostEndIndex - hostBeginIndex); } int rtmpPort = defaultPort; int portIndex = host.indexOf(':'); if (portIndex > 0) { String portString = host.substring(portIndex + 1); rtmpPort = Integer.parseInt(portString); host = host.substring(0, portIndex); } return new ThreeTuple<>(protocol, host, Integer.valueOf(rtmpPort)); } private  UrlUtilities(); static String getBaseURL(URL u); static String getBaseURL(String u); static ThreeTuple<String, String, Integer> getProtocolHostPort(String url, int defaultPort); static boolean isFragmentPresent(URL url); static String getFragment(URL url); static boolean isFile(URL url); static URL toURL(String urlString); static URL toURLNew(String urlOrPathString); static String concatUrlFragments(String... fragments);  }### Answer:
@Test public void testGetProtocolHostPort() { ThreeTuple<String, String, Integer> protoHostPort = UrlUtilities.getProtocolHostPort("http: assertEquals("http", protoHostPort.getFirstObject()); assertEquals("somehost", protoHostPort.getSecondObject()); assertEquals(80, protoHostPort.getThirdObject().intValue()); protoHostPort = UrlUtilities.getProtocolHostPort("rtmpt: assertEquals("rtmpt", protoHostPort.getFirstObject()); assertEquals("host", protoHostPort.getSecondObject()); assertEquals(80, protoHostPort.getThirdObject().intValue()); protoHostPort = UrlUtilities.getProtocolHostPort("rtmp: assertEquals("rtmp", protoHostPort.getFirstObject()); assertEquals("host", protoHostPort.getSecondObject()); assertEquals(1935, protoHostPort.getThirdObject().intValue()); protoHostPort = UrlUtilities.getProtocolHostPort("https: assertEquals("https", protoHostPort.getFirstObject()); assertEquals("somehost", protoHostPort.getSecondObject()); assertEquals(8080, protoHostPort.getThirdObject().intValue()); }