Example usage for io.netty.handler.ssl SniCompletionEvent hostname

List of usage examples for io.netty.handler.ssl SniCompletionEvent hostname

Introduction

In this page you can find the example usage for io.netty.handler.ssl SniCompletionEvent hostname.

Prototype

String hostname

To view the source code for io.netty.handler.ssl SniCompletionEvent hostname.

Click Source Link

Usage

From source file:io.vertx.core.net.impl.SslHandshakeCompletionHandler.java

License:Open Source License

@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
    if (evt instanceof SniCompletionEvent) {
        // Shall we care ?
        SniCompletionEvent completion = (SniCompletionEvent) evt;
        Attribute<String> val = ctx.channel().attr(SERVER_NAME_ATTR);
        val.set(completion.hostname());
    } else if (evt instanceof SslHandshakeCompletionEvent) {
        SslHandshakeCompletionEvent completion = (SslHandshakeCompletionEvent) evt;
        if (completion.isSuccess()) {
            ctx.pipeline().remove(this);
            handler.handle(Future.succeededFuture(ctx.channel()));
        } else {// w  w  w  . ja va2s . co m
            handler.handle(Future.failedFuture(completion.cause()));
        }
    } else {
        ctx.fireUserEventTriggered(evt);
    }
}