WSURI { public static URI toHttp(final URI inputUri) throws URISyntaxException { Objects.requireNonNull(inputUri, "Input URI must not be null"); String wsScheme = inputUri.getScheme(); if ("http".equalsIgnoreCase(wsScheme) || "https".equalsIgnoreCase(wsScheme)) { return inputUri; } if ("ws".equalsIgnoreCase(wsScheme)) { return new URI("http" + inputUri.toString().substring(wsScheme.length())); } if ("wss".equalsIgnoreCase(wsScheme)) { return new URI("https" + inputUri.toString().substring(wsScheme.length())); } throw new URISyntaxException(inputUri.toString(), "Unrecognized WebSocket scheme"); }  static URI toHttp(final URI inputUri); static URI toWebsocket(CharSequence inputUrl); static URI toWebsocket(CharSequence inputUrl, String query); static URI toWebsocket(final URI inputUri);  }
@Test public void testHttpsToHttps() throws URISyntaxException { assertURI(WSURI.toHttp(URI.create("https: }
@Test public void testHttpToHttp() throws URISyntaxException { assertURI(WSURI.toHttp(URI.create("http: }
@Test public void testWssToHttps() throws URISyntaxException { assertURI(WSURI.toHttp(URI.create("wss: }
@Test public void testWsToHttp() throws URISyntaxException { assertURI(WSURI.toHttp(URI.create("ws: }