Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/ciphermod/cipherchat/Test.java


1   /* $Id: Test.java,v 1.1 2001/03/26 10:48:43 cvsbob Exp $ */
2   
3   /*
4    * Test.java, ultra simple test file for the CipherChat ChatClient.
5    * Copyright (C) 2001 Robert Bushman.
6    *
7    * I reserve the right to release this program under seperate license.
8    * If you require a special license grant contact Robert Bushman.
9    *
10   * This program is free software; you can redistribute it and/or
11   * modify it under the terms of the GNU General Public License
12   * as published by the Free Software Foundation; either version 2
13   * of the License, or (at your option) any later version.
14   *
15   * This program is distributed in the hope that it will be useful,
16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18   * GNU General Public License for more details.
19   * 
20   * You should have received a copy of the GNU General Public License
21   * along with this program; if not, write to the Free Software
22   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 
23   * 02111-1307, USA.
24   */
25  
26  package com.ciphermod.cipherchat;
27  
28  public class Test {
29      public static void main( String[] args ) {
30          ChatClient argle = new ChatClient( "Argle",
31                                             "localhost",
32                                             5943 );
33          ChatClient bargle = new ChatClient( "Bargle",
34                                              "localhost",
35                                              5943 );
36          argle.initialize();
37          bargle.initialize();
38          argle.sendMessage( "From Argle 1" );
39          argle.sendMessage( "From Argle 2" );
40          bargle.sendMessage( "From Bargle 1" );
41          try{ synchronized( argle ) { argle.wait( 2000 ); } }
42          catch( Exception e ) {}
43          argle.sendMessage( "From Argle 3" );
44          System.out.println( "Messages sent. Pausing For 5 seconds." );
45          try{ synchronized( argle ) { argle.wait( 5000 ); } }
46          catch( Exception e ) {}
47          Object[] argleMessages = argle.getMessages();
48          Object[] bargleMessages = bargle.getMessages();
49          System.out.println( "--- ARGLE MESSAGES" );
50          for( int i = 0; i < argleMessages.length; i++ ) {
51              System.out.println( (String)argleMessages[i] );
52          }
53          System.out.println( "--- BARGLE MESSAGES" );
54          for( int i = 0; i < bargleMessages.length; i++ ) {
55              System.out.println( (String)bargleMessages[i] );
56          }
57          argle.close();
58          bargle.close();
59      }
60  }
61