test_class.file: dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/server/handler/QosProcessHandlerTest.java
test_class.identifier: QosProcessHandlerTest
test_case.body: @Test
      public void testDecodeTelnet() throws Exception {
          ByteBuf buf = Unpooled.wrappedBuffer(new byte[] {'A'});
          ChannelHandlerContext context = Mockito.mock(ChannelHandlerContext.class);
          ChannelPipeline pipeline = Mockito.mock(ChannelPipeline.class);
          Mockito.when(context.pipeline()).thenReturn(pipeline);
          QosProcessHandler handler = new QosProcessHandler("welcome", false);
          handler.decode(context, buf, Collections.emptyList());
          verify(pipeline).addLast(any(LineBasedFrameDecoder.class));
          verify(pipeline).addLast(any(StringDecoder.class));
          verify(pipeline).addLast(any(StringEncoder.class));
          verify(pipeline).addLast(any(TelnetProcessHandler.class));
          verify(pipeline).remove(handler);
      }
test_case.class_method_signature: QosProcessHandlerTest.testDecodeTelnet()
test_case.full_signature: @Test public void testDecodeTelnet()
test_case.identifier: testDecodeTelnet
test_case.invocations: wrappedBuffer mock mock thenReturn when pipeline decode emptyList addLast verify any addLast verify any addLast verify any addLast verify any remove verify
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testDecodeTelnet()
focal_class.declarator: welcomeFuture
focal_class.modifier: private
focal_class.original_string: private ScheduledFuture<?> welcomeFuture;
focal_class.type: ScheduledFuture<?>
focal_class.var_name: welcomeFuture
focal_class.declarator: welcome
focal_class.modifier: private
focal_class.original_string: private String welcome;
focal_class.type: String
focal_class.var_name: welcome
focal_class.declarator: acceptForeignIp
focal_class.modifier: private
focal_class.original_string: private boolean acceptForeignIp;
focal_class.type: boolean
focal_class.var_name: acceptForeignIp
focal_class.declarator: PROMPT = "dubbo>"
focal_class.modifier: public static final
focal_class.original_string: public static final String PROMPT = "dubbo>";
focal_class.type: String
focal_class.var_name: PROMPT
focal_class.file: dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/server/handler/QosProcessHandler.java
focal_class.identifier: QosProcessHandler
focal_class.class_method_signature: QosProcessHandler.QosProcessHandler(String welcome, boolean acceptForeignIp)
focal_class.full_signature: public  QosProcessHandler(String welcome, boolean acceptForeignIp)
focal_class.identifier: QosProcessHandler
focal_class.modifiers: public
focal_class.parameters: (String welcome, boolean acceptForeignIp)
focal_class.signature:  QosProcessHandler(String welcome, boolean acceptForeignIp)
focal_class.class_method_signature: QosProcessHandler.channelActive(final ChannelHandlerContext ctx)
focal_class.full_signature: @Override public void channelActive(final ChannelHandlerContext ctx)
focal_class.identifier: channelActive
focal_class.modifiers: @Override public
focal_class.parameters: (final ChannelHandlerContext ctx)
focal_class.return: void
focal_class.signature: void channelActive(final ChannelHandlerContext ctx)
focal_class.class_method_signature: QosProcessHandler.decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
focal_class.full_signature: @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
focal_class.identifier: decode
focal_class.modifiers: @Override protected
focal_class.parameters: (ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
focal_class.return: void
focal_class.signature: void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
focal_class.class_method_signature: QosProcessHandler.userEventTriggered(ChannelHandlerContext ctx, Object evt)
focal_class.full_signature: @Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt)
focal_class.identifier: userEventTriggered
focal_class.modifiers: @Override public
focal_class.parameters: (ChannelHandlerContext ctx, Object evt)
focal_class.return: void
focal_class.signature: void userEventTriggered(ChannelHandlerContext ctx, Object evt)
focal_class.class_method_signature: QosProcessHandler.isHttp(int magic)
focal_class.full_signature: private static boolean isHttp(int magic)
focal_class.identifier: isHttp
focal_class.modifiers: private static
focal_class.parameters: (int magic)
focal_class.return: boolean
focal_class.signature: boolean isHttp(int magic)
focal_class.superclass: extends ByteToMessageDecoder
focal_method.body: @Override
      protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
          if (in.readableBytes() < 1) {
              return;
          }
  
          // read one byte to guess protocol
          final int magic = in.getByte(in.readerIndex());
  
          ChannelPipeline p = ctx.pipeline();
          p.addLast(new LocalHostPermitHandler(acceptForeignIp));
          if (isHttp(magic)) {
              // no welcome output for http protocol
              if (welcomeFuture != null && welcomeFuture.isCancellable()) {
                  welcomeFuture.cancel(false);
              }
              p.addLast(new HttpServerCodec());
              p.addLast(new HttpObjectAggregator(1048576));
              p.addLast(new HttpProcessHandler());
              p.remove(this);
          } else {
              p.addLast(new LineBasedFrameDecoder(2048));
              p.addLast(new StringDecoder(CharsetUtil.UTF_8));
              p.addLast(new StringEncoder(CharsetUtil.UTF_8));
              p.addLast(new IdleStateHandler(0, 0, 5 * 60));
              p.addLast(new TelnetProcessHandler());
              p.remove(this);
          }
      }
focal_method.class_method_signature: QosProcessHandler.decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
focal_method.full_signature: @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
focal_method.identifier: decode
focal_method.invocations: readableBytes getByte readerIndex pipeline addLast isHttp isCancellable cancel addLast addLast addLast remove addLast addLast addLast addLast addLast remove
focal_method.modifiers: @Override protected
focal_method.parameters: (ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
focal_method.return: void
focal_method.signature: void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out)