test_class.declarator: handler = new ShutdownTelnetHandler()
test_class.modifier: private static
test_class.original_string: private static TelnetHandler handler = new ShutdownTelnetHandler();
test_class.type: TelnetHandler
test_class.var_name: handler
test_class.declarator: mockChannel
test_class.modifier: private
test_class.original_string: private Channel mockChannel;
test_class.type: Channel
test_class.var_name: mockChannel
test_class.file: dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/ShutdownTelnetHandlerTest.java
test_class.identifier: ShutdownTelnetHandlerTest
test_case.body: @SuppressWarnings("unchecked")
      @Test
      public void testInvoke() throws RemotingException {
          mockChannel = mock(Channel.class);
          String result = handler.telnet(mockChannel, "");
          assertTrue(result.contains("Application has shutdown successfully"));
      }
test_case.class_method_signature: ShutdownTelnetHandlerTest.testInvoke()
test_case.full_signature: @SuppressWarnings("unchecked") @Test public void testInvoke()
test_case.identifier: testInvoke
test_case.invocations: mock telnet assertTrue contains
test_case.modifiers: @SuppressWarnings("unchecked") @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testInvoke()
focal_class.file: dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/legacy/ShutdownTelnetHandler.java
focal_class.identifier: ShutdownTelnetHandler
focal_class.interfaces: implements TelnetHandler
focal_class.class_method_signature: ShutdownTelnetHandler.telnet(Channel channel, String message)
focal_class.full_signature: @Override public String telnet(Channel channel, String message)
focal_class.identifier: telnet
focal_class.modifiers: @Override public
focal_class.parameters: (Channel channel, String message)
focal_class.return: String
focal_class.signature: String telnet(Channel channel, String message)
focal_method.body: @Override
      public String telnet(Channel channel, String message) throws RemotingException {
  
          int sleepMilliseconds = 0;
          if (StringUtils.isNotEmpty(message)) {
              String[] parameters = message.split("\\s+");
              if (parameters.length == 2 && "-t".equals(parameters[0]) && StringUtils.isInteger(parameters[1])) {
                  sleepMilliseconds = Integer.parseInt(parameters[1]);
              } else {
                  return "Invalid parameter,please input like shutdown -t 10000";
              }
          }
          long start = System.currentTimeMillis();
          if (sleepMilliseconds > 0) {
              try {
                  Thread.sleep(sleepMilliseconds);
              } catch (InterruptedException e) {
                  return "Failed to invoke shutdown command, cause: " + e.getMessage();
              }
          }
          StringBuilder buf = new StringBuilder();
          DubboShutdownHook.getDubboShutdownHook().unregister();
          DubboShutdownHook.getDubboShutdownHook().doDestroy();
          long end = System.currentTimeMillis();
          buf.append("Application has shutdown successfully");
          buf.append("\r\nelapsed: ");
          buf.append(end - start);
          buf.append(" ms.");
          return buf.toString();
      }
focal_method.class_method_signature: ShutdownTelnetHandler.telnet(Channel channel, String message)
focal_method.full_signature: @Override public String telnet(Channel channel, String message)
focal_method.identifier: telnet
focal_method.invocations: isNotEmpty split equals isInteger parseInt currentTimeMillis sleep getMessage unregister getDubboShutdownHook doDestroy getDubboShutdownHook currentTimeMillis append append append append toString
focal_method.modifiers: @Override public
focal_method.parameters: (Channel channel, String message)
focal_method.return: String
focal_method.signature: String telnet(Channel channel, String message)