Q:

Android emulator close using telnet via appium script

I am trying to close Android emulator using telnet command via Appium script but after executing the telnet command waiting for manual input for "kill" command.
Unable to execute the "Kill" command along with Appium script.
Runtime.getRuntime().exec("telnet localhost 5554");
Process proc=  Runtime.getRuntime().exec("kill");
BufferedReader r = new BufferedReader(new  InputStreamReader(proc.getInputStream()));
       System.out.println("executed3");
       String line;
       while (true) {
           line = r.readLine();
           if (line == null) { break; }
           System.out.println(line);
       }

A:

This command line use for close the emulator automatically via appium script.
Runtime.getRuntime().exec("tskill emulator-arm");

