I am currently facing an issue with closing the Android emulator using a telnet command in my Appium script. After executing the telnet command, I find that I need to manually input the "kill" command for it to work. Unfortunately, I am unable to execute the "kill" command along with the 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);
}