private final class Http2ConnectionHandler.PrefaceDecoder extends Http2ConnectionHandler.BaseDecoder
Modifier and Type | Field and Description |
---|---|
private ByteBuf |
clientPrefaceString |
private boolean |
prefaceSent |
Constructor and Description |
---|
PrefaceDecoder(ChannelHandlerContext ctx) |
Modifier and Type | Method and Description |
---|---|
void |
channelActive(ChannelHandlerContext ctx) |
void |
channelInactive(ChannelHandlerContext ctx) |
private void |
cleanup()
Releases the
clientPrefaceString . |
void |
decode(ChannelHandlerContext ctx,
ByteBuf in,
java.util.List<java.lang.Object> out) |
void |
handlerRemoved(ChannelHandlerContext ctx)
Releases the
clientPrefaceString . |
boolean |
prefaceSent()
Determine if the HTTP/2 connection preface been sent.
|
private boolean |
readClientPrefaceString(ByteBuf in)
Decodes the client connection preface string from the input buffer.
|
private void |
sendPreface(ChannelHandlerContext ctx)
Sends the HTTP/2 connection preface upon establishment of the connection, if not already sent.
|
private boolean |
verifyFirstFrameIsSettings(ByteBuf in)
Peeks at that the next frame in the buffer and verifies that it is a non-ack
SETTINGS frame. |
private ByteBuf clientPrefaceString
private boolean prefaceSent
public PrefaceDecoder(ChannelHandlerContext ctx)
public boolean prefaceSent()
Http2ConnectionHandler.BaseDecoder
prefaceSent
in class Http2ConnectionHandler.BaseDecoder
public void decode(ChannelHandlerContext ctx, ByteBuf in, java.util.List<java.lang.Object> out) throws java.lang.Exception
decode
in class Http2ConnectionHandler.BaseDecoder
java.lang.Exception
public void channelActive(ChannelHandlerContext ctx) throws java.lang.Exception
channelActive
in class Http2ConnectionHandler.BaseDecoder
java.lang.Exception
public void channelInactive(ChannelHandlerContext ctx) throws java.lang.Exception
channelInactive
in class Http2ConnectionHandler.BaseDecoder
java.lang.Exception
public void handlerRemoved(ChannelHandlerContext ctx) throws java.lang.Exception
clientPrefaceString
. Any active streams will be left in the open.handlerRemoved
in class Http2ConnectionHandler.BaseDecoder
java.lang.Exception
private void cleanup()
clientPrefaceString
. Any active streams will be left in the open.private boolean readClientPrefaceString(ByteBuf in) throws Http2Exception
true
if processing of the client preface string is complete. Since client preface strings can
only be received by servers, returns true immediately for client endpoints.Http2Exception
private boolean verifyFirstFrameIsSettings(ByteBuf in) throws Http2Exception
SETTINGS
frame.in
- the inbound buffer.SETTINGS
frame, false
if more
data is required before we can determine the next frame type.Http2Exception
- thrown if the next frame is NOT a non-ack SETTINGS
frame.private void sendPreface(ChannelHandlerContext ctx)