public static void main(String[] args) {
        int port = setPort(0);
        String ip = setIP("");
        if (args.length == 2) {
            port = Integer.parseInt(args[0]);
            ip = args[1];
        }
        try {
            ChatClient tester = new ChatClient();
            tester.registerEchoListener(new ChatList() {
                @Override
                public void onlineArrived(String data) {
                    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }

                @Override
                public void messageArrived(String userName, String data) {
                    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
            });
            tester.connect(ip, port);
            System.out.println("Sending 'Hello world'");
            //tester.send("Hello World");
            System.out.println("Waiting for a reply");
            tester.close();
            //System.in.read();      
        } catch (UnknownHostException ex) {
            Logger.getLogger(ChatClient.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(ChatClient.class.getName()).log(Level.SEVERE, null, ex);
        }
    }