diff --git a/netty/src/main/java/io/grpc/netty/InternalNettyServerCredentials.java b/netty/src/main/java/io/grpc/netty/InternalNettyServerCredentials.java index db79aa7dcfc7..16e58d943699 100644 --- a/netty/src/main/java/io/grpc/netty/InternalNettyServerCredentials.java +++ b/netty/src/main/java/io/grpc/netty/InternalNettyServerCredentials.java @@ -31,7 +31,7 @@ private InternalNettyServerCredentials() {} /** Creates a {@link ServerCredentials} that will use the provided {@code negotiator}. */ public static ServerCredentials create(InternalProtocolNegotiator.ProtocolNegotiator negotiator) { - return NettyServerCredentials.create(negotiator); + return NettyServerCredentials.create(ProtocolNegotiators.fixedServerFactory(negotiator)); } /** diff --git a/netty/src/main/java/io/grpc/netty/NettyServerCredentials.java b/netty/src/main/java/io/grpc/netty/NettyServerCredentials.java index a734cdf56633..bc8b4f5f6218 100644 --- a/netty/src/main/java/io/grpc/netty/NettyServerCredentials.java +++ b/netty/src/main/java/io/grpc/netty/NettyServerCredentials.java @@ -21,10 +21,6 @@ /** A credential with full control over the security handshake. */ final class NettyServerCredentials extends ServerCredentials { - public static ServerCredentials create(ProtocolNegotiator negotiator) { - return create(ProtocolNegotiators.fixedServerFactory(negotiator)); - } - public static ServerCredentials create(ProtocolNegotiator.ServerFactory negotiator) { return new NettyServerCredentials(negotiator); } diff --git a/netty/src/main/java/io/grpc/netty/NettySslContextServerCredentials.java b/netty/src/main/java/io/grpc/netty/NettySslContextServerCredentials.java index a3c71474a8cd..9396cabdd23b 100644 --- a/netty/src/main/java/io/grpc/netty/NettySslContextServerCredentials.java +++ b/netty/src/main/java/io/grpc/netty/NettySslContextServerCredentials.java @@ -34,6 +34,6 @@ public static ServerCredentials create(SslContext sslContext) { Preconditions.checkArgument(sslContext.isServer(), "Client SSL context can not be used for server"); GrpcSslContexts.ensureAlpnAndH2Enabled(sslContext.applicationProtocolNegotiator()); - return NettyServerCredentials.create(ProtocolNegotiators.serverTls(sslContext)); + return NettyServerCredentials.create(ProtocolNegotiators.serverTlsFactory(sslContext)); } } diff --git a/netty/src/main/java/io/grpc/netty/ProtocolNegotiators.java b/netty/src/main/java/io/grpc/netty/ProtocolNegotiators.java index 8d4ecfdf2e3d..3779d0500957 100644 --- a/netty/src/main/java/io/grpc/netty/ProtocolNegotiators.java +++ b/netty/src/main/java/io/grpc/netty/ProtocolNegotiators.java @@ -192,7 +192,7 @@ public static FromServerCredentialsResult from(ServerCredentials creds) { try { sslContext = builder.build(); } catch (SSLException ex) { - throw new RuntimeException( + throw new IllegalArgumentException( "Unexpected error converting ServerCredentials to Netty SslContext", ex); } return FromServerCredentialsResult.negotiator(serverTlsFactory(sslContext));