@Test public void testBuildInsecureClient() { ServerConfig serverConfig = mock(ServerConfig.class); when(serverConfig.isSsl()).thenReturn(false); when(serverConfig.getProperties()).thenReturn(Collections.emptyMap()); Client client = factory.buildFrom(serverConfig); assertThat(client).isNotNull(); }
public Client buildFrom(final ServerConfig config) { final ClientBuilder clientBuilder = ClientBuilder.newBuilder(); final long pollInterval = new IntervalPropertyHelper(config.getProperties()).partyInfoInterval(); final long timeout = Math.round(Math.ceil(pollInterval * 0.75)); clientBuilder.connectTimeout(timeout, TimeUnit.MILLISECONDS); clientBuilder.readTimeout(timeout, TimeUnit.MILLISECONDS); clientBuilder.register(VersionHeaderDecorator.class); if (config.isUnixSocket()) { Configuration clientConfig = createUnixServerSocketConfig(); URI unixfile = config.getServerUri(); return ClientBuilder.newClient(clientConfig).property("unixfile", unixfile); } else if (config.isSsl()) { final SSLContext sslContext = sslContextFactory.from(config.getServerUri().toString(), config.getSslConfig()); return clientBuilder.sslContext(sslContext).build(); } else { return clientBuilder.build(); } }
ClientFactory implements RestClientFactory { public Client buildFrom(final ServerConfig config) { final ClientBuilder clientBuilder = ClientBuilder.newBuilder(); final long pollInterval = new IntervalPropertyHelper(config.getProperties()).partyInfoInterval(); final long timeout = Math.round(Math.ceil(pollInterval * 0.75)); clientBuilder.connectTimeout(timeout, TimeUnit.MILLISECONDS); clientBuilder.readTimeout(timeout, TimeUnit.MILLISECONDS); clientBuilder.register(VersionHeaderDecorator.class); if (config.isUnixSocket()) { Configuration clientConfig = createUnixServerSocketConfig(); URI unixfile = config.getServerUri(); return ClientBuilder.newClient(clientConfig).property("unixfile", unixfile); } else if (config.isSsl()) { final SSLContext sslContext = sslContextFactory.from(config.getServerUri().toString(), config.getSslConfig()); return clientBuilder.sslContext(sslContext).build(); } else { return clientBuilder.build(); } } }
ClientFactory implements RestClientFactory { public Client buildFrom(final ServerConfig config) { final ClientBuilder clientBuilder = ClientBuilder.newBuilder(); final long pollInterval = new IntervalPropertyHelper(config.getProperties()).partyInfoInterval(); final long timeout = Math.round(Math.ceil(pollInterval * 0.75)); clientBuilder.connectTimeout(timeout, TimeUnit.MILLISECONDS); clientBuilder.readTimeout(timeout, TimeUnit.MILLISECONDS); clientBuilder.register(VersionHeaderDecorator.class); if (config.isUnixSocket()) { Configuration clientConfig = createUnixServerSocketConfig(); URI unixfile = config.getServerUri(); return ClientBuilder.newClient(clientConfig).property("unixfile", unixfile); } else if (config.isSsl()) { final SSLContext sslContext = sslContextFactory.from(config.getServerUri().toString(), config.getSslConfig()); return clientBuilder.sslContext(sslContext).build(); } else { return clientBuilder.build(); } } ClientFactory(final SSLContextFactory sslContextFactory);  ClientFactory(); }
ClientFactory implements RestClientFactory { public Client buildFrom(final ServerConfig config) { final ClientBuilder clientBuilder = ClientBuilder.newBuilder(); final long pollInterval = new IntervalPropertyHelper(config.getProperties()).partyInfoInterval(); final long timeout = Math.round(Math.ceil(pollInterval * 0.75)); clientBuilder.connectTimeout(timeout, TimeUnit.MILLISECONDS); clientBuilder.readTimeout(timeout, TimeUnit.MILLISECONDS); clientBuilder.register(VersionHeaderDecorator.class); if (config.isUnixSocket()) { Configuration clientConfig = createUnixServerSocketConfig(); URI unixfile = config.getServerUri(); return ClientBuilder.newClient(clientConfig).property("unixfile", unixfile); } else if (config.isSsl()) { final SSLContext sslContext = sslContextFactory.from(config.getServerUri().toString(), config.getSslConfig()); return clientBuilder.sslContext(sslContext).build(); } else { return clientBuilder.build(); } } ClientFactory(final SSLContextFactory sslContextFactory);  ClientFactory(); Client buildFrom(final ServerConfig config); }
ClientFactory implements RestClientFactory { public Client buildFrom(final ServerConfig config) { final ClientBuilder clientBuilder = ClientBuilder.newBuilder(); final long pollInterval = new IntervalPropertyHelper(config.getProperties()).partyInfoInterval(); final long timeout = Math.round(Math.ceil(pollInterval * 0.75)); clientBuilder.connectTimeout(timeout, TimeUnit.MILLISECONDS); clientBuilder.readTimeout(timeout, TimeUnit.MILLISECONDS); clientBuilder.register(VersionHeaderDecorator.class); if (config.isUnixSocket()) { Configuration clientConfig = createUnixServerSocketConfig(); URI unixfile = config.getServerUri(); return ClientBuilder.newClient(clientConfig).property("unixfile", unixfile); } else if (config.isSsl()) { final SSLContext sslContext = sslContextFactory.from(config.getServerUri().toString(), config.getSslConfig()); return clientBuilder.sslContext(sslContext).build(); } else { return clientBuilder.build(); } } ClientFactory(final SSLContextFactory sslContextFactory);  ClientFactory(); Client buildFrom(final ServerConfig config);  }