Java Code Examples for io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder#forAddress()

The following examples show how to use io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder#forAddress() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GrpcConfig.java    From benchmarks with Apache License 2.0 6 votes vote down vote up
public static NettyServerBuilder getServerBuilder()
{
    final NettyServerBuilder serverBuilder =
        NettyServerBuilder.forAddress(new InetSocketAddress(getServerHost(), getServerPort()));
    if (getBoolean(TLS))
    {
        final Path certificatesDir = Configuration.certificatesDirectory();
        final SslContextBuilder sslClientContextBuilder = SslContextBuilder.forServer(
            certificatesDir.resolve("server.pem").toFile(), certificatesDir.resolve("server.key").toFile())
            .trustManager(certificatesDir.resolve("ca.pem").toFile())
            .clientAuth(ClientAuth.REQUIRE);
        GrpcSslContexts.configure(sslClientContextBuilder);

        try
        {
            serverBuilder.sslContext(sslClientContextBuilder.build());
        }
        catch (final SSLException ex)
        {
            LangUtil.rethrowUnchecked(ex);
        }
    }
    return serverBuilder;
}
 
Example 2
Source File: ShadedNettyGrpcServerFactory.java    From grpc-spring-boot-starter with MIT License 5 votes vote down vote up
@Override
protected NettyServerBuilder newServerBuilder() {
    final String address = getAddress();
    final int port = getPort();
    if (GrpcServerProperties.ANY_IP_ADDRESS.equals(address)) {
        return NettyServerBuilder.forPort(port);
    } else {
        return NettyServerBuilder.forAddress(new InetSocketAddress(InetAddresses.forString(address), port));
    }
}
 
Example 3
Source File: ShadedNettyGrpcServerFactory.java    From grpc-spring-boot-starter with MIT License 5 votes vote down vote up
@Override
protected NettyServerBuilder newServerBuilder() {
    final String address = getAddress();
    final int port = getPort();
    if (GrpcServerProperties.ANY_IP_ADDRESS.equals(address)) {
        return NettyServerBuilder.forPort(port);
    } else {
        return NettyServerBuilder.forAddress(new InetSocketAddress(InetAddresses.forString(address), port));
    }
}
 
Example 4
Source File: FateServerBuilder.java    From FATE-Serving with Apache License 2.0 2 votes vote down vote up
public static FateServerBuilder forNettyServerBuilderAddress(SocketAddress socketAddress) {

        return new FateServerBuilder(NettyServerBuilder.forAddress(socketAddress));

    }