EndpointUtil { @Nonnull public static String getPath(@Nonnull String endpointUrl) { Matcher matcher = ENDPOINT_URL_PATTERN.matcher(endpointUrl); if (matcher.matches()) { String path = matcher.group(4); if (path == null || path.isEmpty()) { path = "/"; } else if (path.length() > 1 && path.endsWith("/")) { path = path.substring(0, path.length() - 1); } return path; } else { return "/"; } }  @Nullable static String getScheme(@Nonnull String endpointUrl); @Nullable static String getHost(@Nonnull String endpointUrl); static int getPort(@Nonnull String endpointUrl); @Nonnull static String getPath(@Nonnull String endpointUrl); static EndpointDescription updateUrl(
        @Nonnull EndpointDescription endpoint, @Nullable String hostname); static EndpointDescription updateUrl(
        @Nonnull EndpointDescription endpoint, @Nullable String hostname, int port);  }
@Test public void testGetPath_EmptyAndSlash() { assertEquals(EndpointUtil.getPath("opc.tcp: assertEquals(EndpointUtil.getPath("opc.tcp: assertEquals(EndpointUtil.getPath("opc.tcp: assertEquals(EndpointUtil.getPath("opc.tcp: }
@Test public void testGetPath_Invalid() { assertEquals(EndpointUtil.getPath("opc.tcp: "/no spaces allowed"); }
@Test public void testGetPath() { assertEquals(EndpointUtil.getPath("opc.tcp: assertEquals(EndpointUtil.getPath("opc.tcp: assertEquals(EndpointUtil.getPath("opc.tcp: assertEquals(EndpointUtil.getPath("opc.tcp: }