public void handle(int fd) { try { int in = System.in.read(); System.out.println("[" + clientData + "] Received: " + (char) in); if (in == 'q') { IPC.disconnect(); System.exit(-1); } else if (in == 'm') { IPC.publishData(MSG2, "Forwarding"); } else if (in == 'u') { IPC.unsubscribeFD(fd); } // Read in any extra bytes while (System.in.available() > 0) System.in.read(); } catch (Exception e) { e.printStackTrace(); } }