public static void main(String[] args) throws IOException { INonBlockingConnection nbc = new NonBlockingConnection("localhost", 1234, new ClientHandler()); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String msg = null; while ((msg = br.readLine()) != null) { nbc.write(msg + "\r\n"); nbc.flush(); if ("bye".equals(msg)) { nbc.close(); System.exit(1); } } }