MesosClient { static int getPort(@NotNull final URI uri) { final int uriPort = uri.getPort(); if (uriPort > 0) { return uriPort; } else { switch (uri.getScheme()) { case "http": return 80; case "https": return 443; default: throw new IllegalArgumentException("URI Scheme must be http or https"); } } } MesosClient(
        @NotNull final URI mesosUri,
        @NotNull final Function<Class<?>, UserAgentEntry> applicationUserAgentEntry,
        @NotNull final MessageCodec<Send> sendCodec,
        @NotNull final MessageCodec<Receive> receiveCodec,
        @NotNull final Send subscribe,
        @NotNull final Function<Observable<Receive>, Observable<Optional<SinkOperation<Send>>>> streamProcessor,
        @NotNull final  Observable.Transformer<byte[], byte[]> backpressureTransformer
    ); @NotNull AwaitableSubscription openStream();  }
@Test public void testGetPort_returnsSpecifiedPort() throws Exception { assertThat(MesosClient.getPort(URI.create("http: }
@Test public void testGetPort_returns80ForHttp() throws Exception { assertThat(MesosClient.getPort(URI.create("http: }
@Test public void testGetPort_returns443ForHttps() throws Exception { assertThat(MesosClient.getPort(URI.create("https: }
@Test(expected = IllegalArgumentException.class) public void testGetPort_throwsExceptionWhenNoPortIsSpecifiedAndSchemeIsNotHttpOrHttps() throws Exception { MesosClient.getPort(URI.create("ftp: }