Top Description Fields Constructors Methods
io.netty.handler.ssl

public abstract Class SslClientHelloHandler<T>

extends ByteToMessageDecoder
implements ChannelOutboundHandler
Class Inheritance
All Implemented Interfaces
io.netty.channel.ChannelOutboundHandler, io.netty.channel.ChannelHandler
Known Direct Subclasses
io.netty.handler.ssl.AbstractSniHandler
Imports
io.netty.buffer.ByteBuf, .ByteBufUtil, io.netty.channel.ChannelHandlerContext, .ChannelOutboundHandler, .ChannelPromise, io.netty.handler.codec.ByteToMessageDecoder, .DecoderException, .TooLongFrameException, io.netty.util.concurrent.Future, .FutureListener, io.netty.util.internal.ObjectUtil, .PlatformDependent, io.netty.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.net.SocketAddress, java.util.List

ByteToMessageDecoder which allows to be notified once a full ClientHello was received.

Field Summary

Modifier and TypeField and Description
private ByteBuf
private boolean
private static final InternalLogger
public static final int
MAX_CLIENT_HELLO_LENGTH

The maximum length of client hello message as defined by RFC5246.

private final int
private boolean
private boolean
Inherited from io.netty.handler.codec.ByteToMessageDecoder:
COMPOSITE_CUMULATORMERGE_CUMULATOR

Constructor Summary

AccessConstructor and Description
public
protected
SslClientHelloHandler(int maxClientHelloLength)

Method Summary

Modifier and TypeMethod and Description
public void
bind(ChannelHandlerContext
the ChannelHandlerContext for which the bind operation is made
ctx
,
SocketAddress
the SocketAddress to which it should bound
localAddress
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.bind.

Called once a bind operation is made.
public void
close(ChannelHandlerContext
the ChannelHandlerContext for which the close operation is made
ctx
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.close.

Called once a close operation is made.
public void
connect(ChannelHandlerContext
the ChannelHandlerContext for which the connect operation is made
ctx
,
SocketAddress
the SocketAddress to which it should connect
remoteAddress
,
SocketAddress
the SocketAddress which is used as source on connect
localAddress
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.connect.

Called once a connect operation is made.
protected void
decode(ChannelHandlerContext ctx, ByteBuf
the ByteBuf from which to read data
in
,
List<Object>
the List to which decoded messages should be added
out
)

Implements abstract io.netty.handler.codec.ByteToMessageDecoder.decode.

Decode the from one ByteBuf to an other.
public void
deregister(ChannelHandlerContext
the ChannelHandlerContext for which the close operation is made
ctx
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.deregister.

Called once a deregister operation is made from the current registered EventLoop.
public void
disconnect(ChannelHandlerContext
the ChannelHandlerContext for which the disconnect operation is made
ctx
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.disconnect.

Called once a disconnect operation is made.
public void
flush(ChannelHandlerContext
the ChannelHandlerContext for which the flush operation is made
ctx
)

Implements io.netty.channel.ChannelOutboundHandler.flush.

Called once a flush operation is made.
protected void
handlerRemoved0(ChannelHandlerContext ctx)

Overrides io.netty.handler.codec.ByteToMessageDecoder.handlerRemoved0.

Gets called after the ByteToMessageDecoder was removed from the actual context and it doesn't handle events anymore.
protected abstract 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 onLookupComplete(ChannelHandlerContext, Future) on completion.

protected abstract void
public void
private void
private static void
private void
select(final ChannelHandlerContext ctx, ByteBuf clientHello)

public void
write(ChannelHandlerContext
the ChannelHandlerContext for which the write operation is made
ctx
,
Object
the message to write
msg
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.write.

Called once a write operation is made.
Inherited from io.netty.handler.codec.ByteToMessageDecoder:
actualReadableBytescallDecodechannelInactivechannelReadchannelReadCompletedecodeLastdiscardSomeReadByteshandlerRemovedinternalBufferisSingleDecodesetCumulatorsetDiscardAfterReadssetSingleDecodeuserEventTriggered

Field Detail

handshakeBufferback to summary
private ByteBuf handshakeBuffer
handshakeFailedback to summary
private boolean handshakeFailed
loggerback to summary
private static final InternalLogger logger
MAX_CLIENT_HELLO_LENGTHback to summary
public static final int MAX_CLIENT_HELLO_LENGTH

The maximum length of client hello message as defined by RFC5246.

maxClientHelloLengthback to summary
private final int maxClientHelloLength
readPendingback to summary
private boolean readPending
suppressReadback to summary
private boolean suppressRead

Constructor Detail

SslClientHelloHandlerback to summary
public SslClientHelloHandler()
SslClientHelloHandlerback to summary
protected SslClientHelloHandler(int maxClientHelloLength)

Method Detail

bindback to summary
public void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.bind.

Doc from io.netty.channel.ChannelOutboundHandler.bind.

Called once a bind operation is made.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the bind operation is made

localAddress:SocketAddress

the SocketAddress to which it should bound

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
closeback to summary
public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.close.

Doc from io.netty.channel.ChannelOutboundHandler.close.

Called once a close operation is made.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the close operation is made

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
connectback to summary
public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.connect.

Doc from io.netty.channel.ChannelOutboundHandler.connect.

Called once a connect operation is made.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the connect operation is made

remoteAddress:SocketAddress

the SocketAddress to which it should connect

localAddress:SocketAddress

the SocketAddress which is used as source on connect

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
decodeback to summary
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception

Implements abstract io.netty.handler.codec.ByteToMessageDecoder.decode.

Doc from io.netty.handler.codec.ByteToMessageDecoder.decode.

Decode the from one ByteBuf to an other. This method will be called till either the input ByteBuf has nothing to read when return from this method or till nothing was read from the input ByteBuf.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this ByteToMessageDecoder belongs to

in:ByteBuf

the ByteBuf from which to read data

out:List<Object>

the List to which decoded messages should be added

Annotations
@Override
Exceptions
Exception:
is thrown if an error occurs
deregisterback to summary
public void deregister(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.deregister.

Doc from io.netty.channel.ChannelOutboundHandler.deregister.

Called once a deregister operation is made from the current registered EventLoop.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the close operation is made

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
disconnectback to summary
public void disconnect(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.disconnect.

Doc from io.netty.channel.ChannelOutboundHandler.disconnect.

Called once a disconnect operation is made.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the disconnect operation is made

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
flushback to summary
public void flush(ChannelHandlerContext ctx) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.flush.

Doc from io.netty.channel.ChannelOutboundHandler.flush.

Called once a flush operation is made. The flush operation will try to flush out all previous written messages that are pending.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the flush operation is made

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
handlerRemoved0back to summary
protected void handlerRemoved0(ChannelHandlerContext ctx) throws Exception

Overrides io.netty.handler.codec.ByteToMessageDecoder.handlerRemoved0.

Doc from io.netty.handler.codec.ByteToMessageDecoder.handlerRemoved0.

Gets called after the ByteToMessageDecoder was removed from the actual context and it doesn't handle events anymore.

Annotations
@Override
lookupback to summary
protected abstract Future<T> lookup(ChannelHandlerContext ctx, ByteBuf clientHello) throws Exception

Kicks off a lookup for the given ClientHello and returns a Future which in turn will notify the 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;
See Also
onLookupComplete(ChannelHandlerContext, Future)
onLookupCompleteback to summary
protected abstract void onLookupComplete(ChannelHandlerContext ctx, Future<T> future) throws Exception

Called upon completion of the lookup(ChannelHandlerContext, ByteBuf) Future.

See Also
lookup(ChannelHandlerContext, ByteBuf)
readback to summary
public void read(ChannelHandlerContext ctx) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.read.

Doc from io.netty.channel.ChannelOutboundHandler.read.

Intercepts ChannelHandlerContext#read().

Annotations
@Override
releaseHandshakeBufferback to summary
private void releaseHandshakeBuffer()
releaseIfNotNullback to summary
private static void releaseIfNotNull(ByteBuf buffer)
selectback to summary
private void select(final ChannelHandlerContext ctx, ByteBuf clientHello) throws Exception
writeback to summary
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.write.

Doc from io.netty.channel.ChannelOutboundHandler.write.

Called once a write operation is made. The write operation will write the messages through the ChannelPipeline. Those are then ready to be flushed to the actual Channel once Channel#flush() is called

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the write operation is made

msg:Object

the message to write

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs