Class SslClientHelloHandler<T>
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.handler.codec.ByteToMessageDecoder
io.netty.handler.ssl.SslClientHelloHandler<T>
- All Implemented Interfaces:
ChannelHandler, ChannelInboundHandler, ChannelOutboundHandler
- Direct Known Subclasses:
AbstractSniHandler
public abstract class SslClientHelloHandler<T>
extends ByteToMessageDecoder
implements ChannelOutboundHandler
ByteToMessageDecoder which allows to be notified once a full ClientHello was received.-
Nested Class Summary
Nested classes/interfaces inherited from class ByteToMessageDecoder
ByteToMessageDecoder.CumulatorNested classes/interfaces inherited from interface ChannelHandler
ChannelHandler.Sharable -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum length of client hello message as defined by RFC5246.Fields inherited from class ByteToMessageDecoder
COMPOSITE_CUMULATOR, MERGE_CUMULATOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) Called once a bind operation is made.voidclose(ChannelHandlerContext ctx, ChannelPromise promise) Called once a close operation is made.voidconnect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) Called once a connect operation is made.protected voiddecode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) Decode the from oneByteBufto an other.voidderegister(ChannelHandlerContext ctx, ChannelPromise promise) Called once a deregister operation is made from the current registeredEventLoop.voiddisconnect(ChannelHandlerContext ctx, ChannelPromise promise) Called once a disconnect operation is made.voidCalled once a flush operation is made.protected voidGets called after theByteToMessageDecoderwas removed from the actual context and it doesn't handle events anymore.lookup(ChannelHandlerContext ctx, ByteBuf clientHello) Kicks off a lookup for the givenClientHelloand returns aFuturewhich in turn will notify theonLookupComplete(ChannelHandlerContext, Future)on completion.protected abstract voidonLookupComplete(ChannelHandlerContext ctx, Future<T> future) Called upon completion of thelookup(ChannelHandlerContext, ByteBuf)Future.voidInterceptsChannelHandlerContext.read().voidwrite(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) Called once a write operation is made.Methods inherited from class ByteToMessageDecoder
actualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggeredMethods inherited from class ChannelInboundHandlerAdapter
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaughtMethods inherited from class ChannelHandlerAdapter
ensureNotSharable, handlerAdded, isSharableMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChannelHandler
handlerAdded, handlerRemoved
-
Field Details
-
MAX_CLIENT_HELLO_LENGTH
public static final int MAX_CLIENT_HELLO_LENGTHThe maximum length of client hello message as defined by RFC5246.- See Also:
-
-
Constructor Details
-
SslClientHelloHandler
public SslClientHelloHandler() -
SslClientHelloHandler
protected SslClientHelloHandler(int maxClientHelloLength)
-
-
Method Details
-
decode
Description copied from class:ByteToMessageDecoderDecode the from oneByteBufto an other. This method will be called till either the inputByteBufhas nothing to read when return from this method or till nothing was read from the inputByteBuf.- Specified by:
decodein classByteToMessageDecoder- Parameters:
ctx- theChannelHandlerContextwhich thisByteToMessageDecoderbelongs toin- theByteBuffrom which to read dataout- theListto which decoded messages should be added- Throws:
Exception- is thrown if an error occurs
-
handlerRemoved0
Description copied from class:ByteToMessageDecoderGets called after theByteToMessageDecoderwas removed from the actual context and it doesn't handle events anymore.- Overrides:
handlerRemoved0in classByteToMessageDecoder- Throws:
Exception
-
lookup
protected abstract Future<T> lookup(ChannelHandlerContext ctx, ByteBuf clientHello) throws Exception Kicks off a lookup for the givenClientHelloand returns aFuturewhich in turn will notify theonLookupComplete(ChannelHandlerContext, Future)on completion. See https://tools.ietf.org/html/rfc5246#section-7.4.1.2struct { ProtocolVersion client_version; Random random; SessionID session_id; CipherSuite cipher_suitesinvalid input: '<'2..2^16-2>; CompressionMethod compression_methodsinvalid input: '<'1..2^8-1>; select (extensions_present) { case false: struct {}; case true: Extension extensionsinvalid input: '<'0..2^16-1>; }; } ClientHello;- Throws:
Exception- See Also:
-
onLookupComplete
protected abstract void onLookupComplete(ChannelHandlerContext ctx, Future<T> future) throws Exception Called upon completion of thelookup(ChannelHandlerContext, ByteBuf)Future.- Throws:
Exception- See Also:
-
read
Description copied from interface:ChannelOutboundHandlerInterceptsChannelHandlerContext.read().- Specified by:
readin interfaceChannelOutboundHandler- Throws:
Exception
-
bind
public void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) throws Exception Description copied from interface:ChannelOutboundHandlerCalled once a bind operation is made.- Specified by:
bindin interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the bind operation is madelocalAddress- theSocketAddressto which it should boundpromise- theChannelPromiseto notify once the operation completes- Throws:
Exception- thrown if an error occurs
-
connect
public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) throws Exception Description copied from interface:ChannelOutboundHandlerCalled once a connect operation is made.- Specified by:
connectin interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the connect operation is maderemoteAddress- theSocketAddressto which it should connectlocalAddress- theSocketAddresswhich is used as source on connectpromise- theChannelPromiseto notify once the operation completes- Throws:
Exception- thrown if an error occurs
-
disconnect
Description copied from interface:ChannelOutboundHandlerCalled once a disconnect operation is made.- Specified by:
disconnectin interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the disconnect operation is madepromise- theChannelPromiseto notify once the operation completes- Throws:
Exception- thrown if an error occurs
-
close
Description copied from interface:ChannelOutboundHandlerCalled once a close operation is made.- Specified by:
closein interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the close operation is madepromise- theChannelPromiseto notify once the operation completes- Throws:
Exception- thrown if an error occurs
-
deregister
Description copied from interface:ChannelOutboundHandlerCalled once a deregister operation is made from the current registeredEventLoop.- Specified by:
deregisterin interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the close operation is madepromise- theChannelPromiseto notify once the operation completes- Throws:
Exception- thrown if an error occurs
-
write
Description copied from interface:ChannelOutboundHandlerCalled once a write operation is made. The write operation will write the messages through theChannelPipeline. Those are then ready to be flushed to the actualChannelonceChannel.flush()is called- Specified by:
writein interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the write operation is mademsg- the message to writepromise- theChannelPromiseto notify once the operation completes- Throws:
Exception- thrown if an error occurs
-
flush
Description copied from interface:ChannelOutboundHandlerCalled once a flush operation is made. The flush operation will try to flush out all previous written messages that are pending.- Specified by:
flushin interfaceChannelOutboundHandler- Parameters:
ctx- theChannelHandlerContextfor which the flush operation is made- Throws:
Exception- thrown if an error occurs
-