Exemplo n.º 1
0
 @Override
 public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
   // Initialize the encoder, decoder, flow controllers, and internal state.
   encoder.lifecycleManager(this);
   decoder.lifecycleManager(this);
   encoder.flowController().channelHandlerContext(ctx);
   decoder.flowController().channelHandlerContext(ctx);
   byteDecoder = new PrefaceDecoder(ctx);
 }
Exemplo n.º 2
0
 @Override
 public void channelInactive(ChannelHandlerContext ctx) throws Exception {
   if (byteDecoder != null) {
     encoder.flowController().channelHandlerContext(null);
     decoder.flowController().channelHandlerContext(null);
     byteDecoder.channelInactive(ctx);
     super.channelInactive(ctx);
     byteDecoder = null;
   }
 }
Exemplo n.º 3
0
 @Override
 public void flush(ChannelHandlerContext ctx) throws Http2Exception {
   // Trigger pending writes in the remote flow controller.
   encoder.flowController().writePendingBytes();
   try {
     super.flush(ctx);
   } catch (Throwable t) {
     throw new Http2Exception(INTERNAL_ERROR, "Error flushing", t);
   }
 }