public abstract class AbstractSniHandler<T> extends SslClientHelloHandler<T>
Enables SNI (Server Name Indication) extension for server side SSL. For clients support SNI, the server could have multiple host name bound on a single IP. The client will send host name in the handshake data so server could decide which certificate to choose for the host name.
ByteToMessageDecoder.Cumulator
ChannelHandler.Sharable
限定符和类型 | 字段和说明 |
---|---|
protected long |
handshakeTimeoutMillis |
MAX_CLIENT_HELLO_LENGTH
COMPOSITE_CUMULATOR, MERGE_CUMULATOR
限定符 | 构造器和说明 |
---|---|
|
AbstractSniHandler() |
protected |
AbstractSniHandler(int maxClientHelloLength,
long handshakeTimeoutMillis) |
protected |
AbstractSniHandler(long handshakeTimeoutMillis) |
限定符和类型 | 方法和说明 |
---|---|
void |
channelActive(ChannelHandlerContext ctx)
Calls
ChannelHandlerContext.fireChannelActive() to forward
to the next ChannelInboundHandler in the ChannelPipeline . |
void |
handlerAdded(ChannelHandlerContext ctx)
Do nothing by default, sub-classes may override this method.
|
protected Future<T> |
lookup(ChannelHandlerContext ctx,
ByteBuf clientHello)
Kicks off a lookup for the given
ClientHello and returns a Future which in turn will
notify the SslClientHelloHandler.onLookupComplete(ChannelHandlerContext, Future) on completion. |
protected abstract Future<T> |
lookup(ChannelHandlerContext ctx,
java.lang.String hostname)
Kicks off a lookup for the given SNI value and returns a
Future which in turn will
notify the onLookupComplete(ChannelHandlerContext, String, Future) on completion. |
protected void |
onLookupComplete(ChannelHandlerContext ctx,
Future<T> future)
Called upon completion of the
SslClientHelloHandler.lookup(ChannelHandlerContext, ByteBuf) Future . |
protected abstract void |
onLookupComplete(ChannelHandlerContext ctx,
java.lang.String hostname,
Future<T> future)
Called upon completion of the
lookup(ChannelHandlerContext, String) Future . |
bind, close, connect, decode, deregister, disconnect, flush, handlerRemoved0, read, write
actualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggered
channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught
ensureNotSharable, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exceptionCaught, handlerRemoved
protected AbstractSniHandler(long handshakeTimeoutMillis)
handshakeTimeoutMillis
- the handshake timeout in millisecondsprotected AbstractSniHandler(int maxClientHelloLength, long handshakeTimeoutMillis)
handshakeTimeoutMillis
- the handshake timeout in millisecondspublic AbstractSniHandler()
public void handlerAdded(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelHandlerAdapter
handlerAdded
在接口中 ChannelHandler
handlerAdded
在类中 ChannelHandlerAdapter
java.lang.Exception
public void channelActive(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireChannelActive()
to forward
to the next ChannelInboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.channelActive
在接口中 ChannelInboundHandler
channelActive
在类中 ChannelInboundHandlerAdapter
java.lang.Exception
protected Future<T> lookup(ChannelHandlerContext ctx, ByteBuf clientHello) throws java.lang.Exception
SslClientHelloHandler
ClientHello
and returns a Future
which in turn will
notify the SslClientHelloHandler.onLookupComplete(ChannelHandlerContext, Future)
on completion.
See https://tools.ietf.org/html/rfc5246#section-7.4.1.2
struct { ProtocolVersion client_version; Random random; SessionID session_id; CipherSuite cipher_suites<2..2^16-2>; CompressionMethod compression_methods<1..2^8-1>; select (extensions_present) { case false: struct {}; case true: Extension extensions<0..2^16-1>; }; } ClientHello;
lookup
在类中 SslClientHelloHandler<T>
java.lang.Exception
SslClientHelloHandler.onLookupComplete(ChannelHandlerContext, Future)
protected void onLookupComplete(ChannelHandlerContext ctx, Future<T> future) throws java.lang.Exception
SslClientHelloHandler
SslClientHelloHandler.lookup(ChannelHandlerContext, ByteBuf)
Future
.onLookupComplete
在类中 SslClientHelloHandler<T>
java.lang.Exception
SslClientHelloHandler.lookup(ChannelHandlerContext, ByteBuf)
protected abstract Future<T> lookup(ChannelHandlerContext ctx, java.lang.String hostname) throws java.lang.Exception
Future
which in turn will
notify the onLookupComplete(ChannelHandlerContext, String, Future)
on completion.java.lang.Exception
onLookupComplete(ChannelHandlerContext, String, Future)
protected abstract void onLookupComplete(ChannelHandlerContext ctx, java.lang.String hostname, Future<T> future) throws java.lang.Exception
lookup(ChannelHandlerContext, String)
Future
.java.lang.Exception
lookup(ChannelHandlerContext, String)