public static void main(string[] args) { try { CommandInterpreter commandInterpreter = new CommandInterpreter(); SocketCommandClient socketCommandClient = new SocketCommandClient("localhost", 7890); commandInterpreter.add("s", new SocketCommandClient_1(socketCommandClient)); commandInterpreter.add("r", new SocketCommandClient_2(socketCommandClient)); commandInterpreter.add("sr", new SocketCommandClient_3(socketCommandClient)); commandInterpreter.setPrompt("scc-test> "); commandInterpreter.run(); } catch (System.Exception ex) { java.lang.System.err.println("error occured."); Throwable.instancehelper_printStackTrace(ex); java.lang.System.exit(-1); } return; }
private void spawnCommandInterpreter(Socket socket) { try { BufferedReader @in = new BufferedReader(new InputStreamReader(socket.getInputStream())); PrintWriter @out = new PrintWriter(socket.getOutputStream(), true); CommandInterpreter commandInterpreter = new CommandInterpreter(@in, @out); commandInterpreter.setSocket(socket); commandInterpreter.add(this.commandList); commandInterpreter.setTrace(this.trace); commandInterpreter.start(); } catch (IOException ex) { java.lang.System.err.println(new StringBuilder().append("Could not attach CI to socket ").append(ex).toString()); } }