### Question:
NettyChannelBuilder extends AbstractManagedChannelImplBuilder<NettyChannelBuilder> { public NettyChannelBuilder sslContext(SslContext sslContext) { if (sslContext != null) { checkArgument(sslContext.isClient(), "Server SSL context can not be used for client channel"); GrpcSslContexts.ensureAlpnAndH2Enabled(sslContext.applicationProtocolNegotiator()); } this.sslContext = sslContext; return this; } @CheckReturnValue  NettyChannelBuilder(String host, int port); @CheckReturnValue  NettyChannelBuilder(String target); @CheckReturnValue  NettyChannelBuilder(SocketAddress address); @CheckReturnValue static NettyChannelBuilder forAddress(SocketAddress serverAddress); @CheckReturnValue static NettyChannelBuilder forAddress(String host, int port); @CheckReturnValue static NettyChannelBuilder forTarget(String target); NettyChannelBuilder channelType(Class<? extends Channel> channelType); NettyChannelBuilder withOption(ChannelOption<T> option, T value); NettyChannelBuilder negotiationType(NegotiationType type); NettyChannelBuilder eventLoopGroup(@Nullable EventLoopGroup eventLoopGroup); NettyChannelBuilder sslContext(SslContext sslContext); NettyChannelBuilder flowControlWindow(int flowControlWindow); @Deprecated NettyChannelBuilder maxHeaderListSize(int maxHeaderListSize); @Override NettyChannelBuilder maxInboundMetadataSize(int bytes); @Override @Deprecated NettyChannelBuilder usePlaintext(boolean skipNegotiation); @Override NettyChannelBuilder usePlaintext(); @Override NettyChannelBuilder useTransportSecurity(); @Deprecated final NettyChannelBuilder enableKeepAlive(boolean enable); @Deprecated final NettyChannelBuilder enableKeepAlive(boolean enable, long keepAliveTime,
      TimeUnit delayUnit, long keepAliveTimeout, TimeUnit timeoutUnit); @Override NettyChannelBuilder keepAliveTime(long keepAliveTime, TimeUnit timeUnit); @Override NettyChannelBuilder keepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit); @Override NettyChannelBuilder keepAliveWithoutCalls(boolean enable); NettyChannelBuilder localSocketPicker(@Nullable LocalSocketPicker localSocketPicker); static final int DEFAULT_FLOW_CONTROL_WINDOW; }### Answer:
@Test public void sslContextCanBeNull() { NettyChannelBuilder builder = new NettyChannelBuilder(new SocketAddress(){}); builder.sslContext(null); }
@Test public void failIfSslContextIsNotClient() { SslContext sslContext = mock(SslContext.class); NettyChannelBuilder builder = new NettyChannelBuilder(new SocketAddress(){}); thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Server SSL context can not be used for client channel"); builder.sslContext(sslContext); }