### Question:
RequestEncoder { public static String encodeBaseURI(final String url) throws UnsupportedEncodingException { if (url.startsWith("http") && url.contains(":" + HTTP_PORT)) return URLEncoder.encode(url.toLowerCase(Locale.ENGLISH) .replace(":" + HTTP_PORT, ""), "UTF-8"); else if (url.startsWith("https") && url.contains(":" + HTTPS_PORT)) return URLEncoder.encode(url.toLowerCase(Locale.ENGLISH) .replace(":" + HTTPS_PORT, ""), "UTF-8"); else return URLEncoder.encode(url.toLowerCase(Locale.ENGLISH), "UTF-8"); } private  RequestEncoder(); static String normalizeParametersQuery(
            final TreeMap<String, String> parameters); static String encodeBaseURI(final String url);  }### Answer:
@Test public void testEncodeBaseURI() throws UnsupportedEncodingException { String url = "https: assertEquals(RequestEncoder.encodeBaseURI(url), "https%3A%2F%2Flocalhost%3A9443%2Fregister"); url = "https: assertEquals(RequestEncoder.encodeBaseURI(url), "https%3A%2F%2Flocalhost%2Fregister"); url = "http: assertEquals(RequestEncoder.encodeBaseURI(url), "http%3A%2F%2Flocalhost%2Fregister"); }