Example usage for io.netty.handler.ssl SslContext applicationProtocolNegotiator

List of usage examples for io.netty.handler.ssl SslContext applicationProtocolNegotiator

Introduction

In this page you can find the example usage for io.netty.handler.ssl SslContext applicationProtocolNegotiator.

Prototype

public abstract ApplicationProtocolNegotiator applicationProtocolNegotiator();

Source Link

Document

Returns the object responsible for negotiating application layer protocols for the TLS NPN/ALPN extensions.

Usage

From source file:io.grpc.netty.NettyChannelBuilder.java

License:Apache License

/**
 * SSL/TLS context to use instead of the system default. It must have been configured with {@link
 * GrpcSslContexts}, but options could have been overridden.
 *///from   w w  w.j a va2 s  . c  om
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;
}

From source file:io.grpc.netty.NettyServerBuilder.java

License:Apache License

/**
 * Sets the TLS context to use for encryption. Providing a context enables encryption. It must
 * have been configured with {@link GrpcSslContexts}, but options could have been overridden.
 *//* ww  w  .ja v  a 2  s  .  co  m*/
public NettyServerBuilder sslContext(SslContext sslContext) {
    if (sslContext != null) {
        checkArgument(sslContext.isServer(), "Client SSL context can not be used for server");
        GrpcSslContexts.ensureAlpnAndH2Enabled(sslContext.applicationProtocolNegotiator());
    }
    this.sslContext = sslContext;
    return this;
}