NettyConnectStrategy implements ConnectStrategy<NettyChannelBuilder> { @Override public NettyChannelBuilder connect(final HostnameAndPort hostnameAndPort) { return NettyChannelBuilder.forAddress(hostnameAndPort.getHostname(), hostnameAndPort.getPort()) .keepAliveTime(300L, TimeUnit.SECONDS) .keepAliveWithoutCalls(true); }  @Override NettyChannelBuilder connect(final HostnameAndPort hostnameAndPort);  }
@Test public void testConnect() throws InterruptedException { final NettyConnectStrategy connectStrategy = new NettyConnectStrategy(); final ManagedChannel channel = connectStrategy.connect(HostnameAndPort.of("localhost:9999")) .build(); assertNotNull(channel); channel.shutdown().awaitTermination(1, SECONDS); }