aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/BenchLocal.java111
-rw-r--r--tests/Bug.java14
-rw-r--r--tests/DieSender.java43
-rw-r--r--tests/Makefile62
-rw-r--r--tests/NewLine.java66
-rw-r--r--tests/ProbeBench.java39
-rw-r--r--tests/TESTBENCH15
-rw-r--r--tests/TestApi.java48
-rw-r--r--tests/TestNet.java33
9 files changed, 327 insertions, 104 deletions
diff --git a/tests/BenchLocal.java b/tests/BenchLocal.java
index f8dc6ac..f0b6863 100644
--- a/tests/BenchLocal.java
+++ b/tests/BenchLocal.java
@@ -1,21 +1,33 @@
-import gnu.regexp.*;
-import gnu.getopt.*;
-import fr.dgac.ivy.*;
-import java.io.*;
-
-/*
+/**
+ * Ivy software bus bench tester
+ *
+ * @author Yannick Jestin <jestin@cena.fr>
+ *
+ * (c) CENA 1998-2004
+ *
* a program with 2 busses testing
* - the rendez vous
* - the IvyMessageListener interface
* - disconnect part of the IvyApplicationListener interface
+ *
+ * CHANGELOG
+ * 1.2.6
+ * - added a timestamp to facilitate the batch processing
+ * - no more necessary to invoque system.exit() when both busses have left.
+ * it used to produce an Exception ...
+ *
*/
+import gnu.getopt.*;
+import fr.dgac.ivy.*;
+import java.io.*;
+
class BenchLocal {
public static final String helpmsg = "usage: java TestLocal [options]\n\t-b domain\n\t-d delay (in ms)\n\t-t test number\n\t-h\thelp\n\n";
- public static void main(String[] args) {
+ public static void main(String[] args) throws IvyException {
Getopt opt = new Getopt("BenchLocal",args,"t:b:d:h");
- String domain=Ivy.getDomain(null); // default bus
+ String domain=Ivy.getDomain(null);
int delay=2000;
int c;
int testtoperform=1;
@@ -37,25 +49,16 @@ class BenchLocal {
new BenchLocal(testtoperform,domain,delay);
}
- public BenchLocal(int testtoperform,String domain,int delay) {
- try {
- switch (testtoperform) {
- case 2: testRegex(domain,delay); break;
- case 1:
- default: test2bus(domain,delay); break;
- }
- } catch (IvyException ie) {
- fail(ie.getMessage());
+ public BenchLocal(int testtoperform,String domain,int delay) throws IvyException {
+ switch (testtoperform) {
+ case 2: testRegex(domain,delay); break;
+ case 1:
+ default: test2bus(domain,delay); break;
}
}
- void fail(String msg) {
- System.out.println("failed: "+msg);
- System.exit(-1);
- }
-
void sleep(int delay) {
- System.out.println("waiting "+delay+" ms");
+ log("waiting "+delay+" ms");
try { Thread.sleep(delay); } catch (InterruptedException ie) { }
}
@@ -64,7 +67,6 @@ class BenchLocal {
IAL ial=new IAL();
bus1=new Ivy("BUS1","Bus1 ready",ial);
bus2=new Ivy("BUS2","Bus2 ready",ial);
- ial.setBusses(bus1,bus2);
bus1.bindMsg("^Bus2 ready",new RML(bus1,delay));
SuccessStory success=new SuccessStory(bus1,bus2);
bus2.bindMsg("^([^ ]*) ([^ ]*) ([^ ]*)$",new RMLAnswer1(success));
@@ -79,11 +81,14 @@ class BenchLocal {
int delay;
public RML(Ivy b,int delay) { this.b=b;this.delay=delay; }
public void receive(IvyClient c,String[] args) {
- b.sendMsg("a b c");
- sleep(delay);
- b.sendMsg("");
- sleep(delay);
- b.sendMsg("x=1 y=2 z=3");
+ try {
+ b.sendMsg("a b c");
+ sleep(delay);
+ b.sendMsg("");
+ sleep(delay);
+ b.sendMsg("x=1 y=2 z=3");
+ } catch (IvyException ie) {
+ }
b.stop();
}
}
@@ -94,9 +99,9 @@ class BenchLocal {
public SuccessStory(Ivy b1,Ivy b2){this.b1=b1;this.b2=b2;}
public void incr(){
i++;
- System.out.println("regex "+i+" successful");
+ log("regex "+i+" successful");
if (i==3) {
- System.out.println("quitting the bus");
+ log("quitting the bus");
b1.stop();b2.stop();
}
}
@@ -134,16 +139,15 @@ class BenchLocal {
public void test2bus(String domain,int delay) throws IvyException {
Ivy bus1,bus2;
IAL ial=new IAL();
- System.out.println("starting with delay="+delay+" ms between the two starts");
+ log("starting with delay="+delay+" ms between the two starts");
bus1=new Ivy("BUS1","Bus1 ready",ial);
bus2=new Ivy("BUS2","Bus2 ready",ial);
- ial.setBusses(bus1,bus2);
bus1.bindMsg("^Bus2 ready",new SENDOUT(bus1));
bus2.bindMsg("^out$",new DIE(bus2));
- System.out.println("starting Bus1");
+ log("starting Bus1");
bus1.start(domain);
sleep(delay);
- System.out.println("starting Bus2");
+ log("starting Bus2");
bus2.start(domain);
}
@@ -151,39 +155,32 @@ class BenchLocal {
Ivy b;
public SENDOUT(Ivy b) {this.b=b;}
public void receive(IvyClient client,String[] arg) {
- System.out.println("received ready message");
- b.sendMsg("out");
+ log("received ready message");
+ try {
+ b.sendMsg("out");
+ } catch (IvyException ie) {
+ }
b.stop();
}
}
- private class IAL implements IvyApplicationListener {
- Ivy b1,b2;
- int count=0;
- public void setBusses(Ivy b1,Ivy b2) {
- this.b1=b1;
- this.b2=b2;
- }
- public void disconnect(IvyClient c) {
- if ( (c.getApplicationName().compareTo("BUS1")==0)
- ||(c.getApplicationName().compareTo("BUS2")==0) ) {
- count++;
- System.out.println(c.getApplicationName()+" left");
- if (count==2) {System.exit(0);}
- }
- }
- public void connect(IvyClient c) { }
- public void directMessage(IvyClient c,int id,String arg) { }
- public void die(IvyClient c,int id) { }
+ private class IAL extends IvyApplicationAdapter {
+ public void disconnect(IvyClient c) { log(c.getApplicationName()+" left"); }
}
private class DIE implements IvyMessageListener {
Ivy b;
public DIE(Ivy b) {this.b=b; }
public void receive(IvyClient client,String[] arg) {
- System.out.println("received out message");
- b.stop();
+ log("received out message");
+ b.stop(); // I leave the bus
}
}
+ private static java.text.DateFormat df = java.text.DateFormat.getTimeInstance();
+ private void log(String s) {
+ java.util.Date d = new java.util.Date();
+ System.out.println("* ["+df.format(d)+"] "+s);
+ }
+
}
diff --git a/tests/Bug.java b/tests/Bug.java
index 706d951..398bbee 100644
--- a/tests/Bug.java
+++ b/tests/Bug.java
@@ -19,15 +19,17 @@ class Bug implements IvyApplicationListener {
public void connect(IvyClient client) {
System.out.println("sending messages");
- bus.sendMsg("coucou");
- bus.sendMsg("titi");
- bus.sendMsg("tata");
- bus.sendMsg("toto");
+ try {
+ bus.sendMsg("coucou");
+ bus.sendMsg("titi");
+ bus.sendMsg("tata");
+ bus.sendMsg("toto");
+ } catch (IvyException ie) { }
System.out.println("done");
}
- public void die(IvyClient client,int id) {
- System.out.println("argh. cya");
+ public void die(IvyClient client,int id,String msg) {
+ System.out.println("argh. cya "+msg);
}
public static void main(String args[]) {
diff --git a/tests/DieSender.java b/tests/DieSender.java
new file mode 100644
index 0000000..c44446b
--- /dev/null
+++ b/tests/DieSender.java
@@ -0,0 +1,43 @@
+/*
+ * sends die to the client specified by a string.
+ */
+import fr.dgac.ivy.* ;
+
+public class DieSender extends IvyApplicationAdapter {
+
+ private String tokill;
+ private int targets = 0;
+
+ public DieSender(Ivy bus,String mtokill) throws IvyException {
+ this.tokill=mtokill;
+ bus.addApplicationListener(this);
+ }
+
+ /*
+ public void disconnect(IvyClient c) {
+ System.out.println(c.getApplicationName());
+ if (c.getApplicationName().compareTo(tokill)==0) {
+ System.out.println(tokill+" left the bus");
+ }
+ }
+ */
+
+ public void connect(IvyClient c) {
+ if (c.getApplicationName().compareTo(tokill)==0) {
+ System.out.println("found a "+tokill+" on the bus, sending Die Message");
+ c.sendDie("meurs !");
+ }
+ }
+
+ public static final String DEFAULTTOKILL = "JPROBE" ;
+
+ public static void main(String[] args) throws IvyException {
+ String mtokill = DEFAULTTOKILL;
+ String domain = Ivy.getDomain(null);
+ System.out.println("will kill each and every " + mtokill + " on the " + domain +" bus");
+ Ivy bus = new Ivy("DieSender","DieSender ready",null);
+ bus.start(Ivy.getDomain(null));
+ new DieSender(bus,mtokill);
+ }
+
+}
diff --git a/tests/Makefile b/tests/Makefile
index 7ebc5a8..e2b0aa0 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,10 +1,18 @@
.SUFFIXES: .java .class
-SRC = TestNet.java Bug.java BugTok.java BenchLocal.java ProbeBench.java DieSender.java TestApi.java
+SRC = TestNet.java Bug.java BugTok.java BenchLocal.java ProbeBench.java \
+ DieSender.java TestApi.java NewLine.java AsyncAPI.java
OBJ = $(SRC:.java=.class)
+#BUS=
+BUS=-DIVYBUS=224.5.6.7:8910
-GNUPATH=/usr/share/java/repository:/usr/share/java/gnu.getopt.0.9.jar:/usr/share/java/gnu-regexp-1.1.3.jar
+#GNUPATH=$(HOME)/JavaFactory
+#GNUPATH=/usr/share/java/gnu.getopt.0.9.jar:/usr/share/java/gnu-regexp-1.1.3.jar
+#GNUPATH=/usr/share/java/regexp.jar:/usr/share/java/gnu-getopt.jar
+#GNUPATH=/usr/share/java/repository:/usr/share/java/gnu.getopt.0.9.jar:/usr/share/java/gnu-regexp-1.1.3.jar
+#GNUPATH=
BUILDPATH=../lib/ivy-java.jar
-ADD=$(GNUPATH):$(BUILDPATH)
+#ADD=$(BUILDPATH):$(GNUPATH)
+ADD=$(BUILDPATH)
#JAVAOPTS = -DIVY_PING
# DONOTBUILD = TestNetSwing.java # Color(r,g,b,a) doesn't exist in jdk1.1
@@ -12,18 +20,40 @@ ADD=$(GNUPATH):$(BUILDPATH)
######################################
# generic setup
######################################
+#RTPATH = /usr/lib/j2se/1.4/jre/lib/rt.jar
+#CLASSPATH=-classpath .:$(ADD):$(RTPATH)
CLASSPATH=-classpath .:$(ADD)
-JAVACOPTS= -deprecation
-JAVAOPTS =
+JAVACOPTS= -deprecation
+JAVAOPTS = $(BUS)
+#JAVAOPTS = $(BUS) -DIVY_DEBUG
+#JAVAC= jikes
JAVAC= javac
JAVA = java
######################################
+# generic setup
+######################################
+#CLASSPATH=-classpath .:$(ADD)
+#JAVACOPTS= -deprecation
+#JAVAOPTS = $(BUS)
+#JAVAC= javac
+#JAVA = java
+
+######################################
+# SUN 1.4.0
+######################################
+#CLASSPATH=-classpath .:$(ADD)
+#JAVACOPTS= -deprecation
+#JAVAOPTS = $(BUS)
+#JAVAC= /opt/Java/j2sdk1.4.0_01/bin/javac
+#JAVA = /opt/Java/j2sdk1.4.0_01/bin/java
+
+######################################
# local Blackdown linux 118_v3 system
######################################
#CLASSPATH = -classpath .:/usr/local/jdk118_v3/lib/classes.zip:/home/jestin/java/Jars/swingall.jar:$(ADD)
#JAVACOPTS =
-#JAVAOPTS =
+#JAVAOPTS = $(BUS)
#JAVA = /usr/local/jdk118_v3/bin/java
#JAVAC = /usr/local/jdk118_v3/bin/javac
@@ -32,7 +62,7 @@ JAVA = java
######################################
#CLASSPATH = -classpath .:$(ADD)
#JAVACOPTS = -deprecation
-#JAVAOPTS =
+#JAVAOPTS = $(BUS)
#JAVA = /usr/local/jdk1.2.2/bin/java
#JAVAC = /usr/local/jdk1.2.2/bin/javac
@@ -41,24 +71,34 @@ JAVA = java
######################################
#CLASSPATH = -classpath .:$(ADD)
#JAVACOPTS = -deprecation
-#JAVAOPTS =
+#JAVAOPTS = $(BUS)
#JAVA = /usr/local/j2sdk1.3.1/bin/java
#JAVAC = /usr/local/j2sdk1.3.1/bin/javac
#LOCALNET=10.0.0.255:3456
-
-LOCALNET=10.192.36.255:3456
+LOCALNET=$(MULTICAST)
+#LOCALNET=10.192.36.255:3456
MULTICAST=228.1.2.3:4567
.java.class:
$(JAVAC) $(JAVACOPTS) $(CLASSPATH) $<
-all: $(OBJ) api unitaires test1 test2 probe
+all: $(OBJ)
+ @echo "all modules built. run make run"
+
+run: $(OBJ) nl api unitaires test1 test2 probe async
+nl:
+ $(JAVA) $(JAVAOPTS) $(CLASSPATH) NewLine -n 100000
+
probe:
$(JAVA) $(JAVAOPTS) $(CLASSPATH) fr.dgac.ivy.Probe < /dev/null
+
api:
$(JAVA) $(JAVAOPTS) $(CLASSPATH) TestApi
+async: AsyncAPI.class
+ $(JAVA) $(JAVAOPTS) $(CLASSPATH) AsyncAPI -r -l 20 -d 5 -s 10000
+
unitaires:
$(JAVA) $(JAVAOPTS) $(CLASSPATH) fr.dgac.ivy.Ivy
diff --git a/tests/NewLine.java b/tests/NewLine.java
new file mode 100644
index 0000000..78835a3
--- /dev/null
+++ b/tests/NewLine.java
@@ -0,0 +1,66 @@
+import fr.dgac.ivy.* ;
+import gnu.getopt.*;
+
+class NewLine {
+
+ Ivy bus;
+
+ public static void main(String[] args) throws IvyException {
+ Getopt opt = new Getopt("NewLine",args,"b:n:");
+ String domain=Ivy.getDomain(null); // default bus
+ int c;
+ int nb = 10000;
+ while ((c = opt.getopt()) != -1) switch (c) {
+ case 'n':
+ nb=Integer.parseInt(opt.getOptarg());
+ break;
+ case 'b':
+ domain=opt.getOptarg();
+ break;
+ default:
+ System.exit(0);
+ }
+ new NewLine(domain,nb);
+ }
+
+ private int recus = 0;
+ private int nbmsg;
+
+ public NewLine(String domain,int n) throws IvyException {
+ System.out.println("trying Newline on " + n + " tests");
+ nbmsg=n;
+ bus = new Ivy("NewLine","NewLine ready", null);
+ // System.out.println("protectnewline is OFF in 1.2.4 !!!");
+ bus.protectNewlines(true);
+ bus.sendToSelf(true);
+ bus.bindMsg("^coucou(.)monde$",new IvyMessageListener() {
+ public void receive(IvyClient ic,String[] args) {
+ recus++;
+ if (recus==nbmsg) System.out.println("received "+nbmsg+" ["+args[0]+"]");
+ }
+ });
+ bus.start(domain);
+ // try { Thread.sleep(2000); } catch (InterruptedException ie) { }
+ long t1,t2,t3;
+ t1=(new java.util.Date()).getTime();
+ System.out.println("sending "+nbmsg+" protected newlines");
+ for (int i=0;i<n;i++ ) {
+ try {
+ bus.sendMsg("coucou\nmonde");
+ } catch (IvyException ie) {
+ System.out.println("exception raised. Exitting");
+ bus.stop();
+ System.exit(-1);
+ }
+ }
+ System.out.println("sending "+nbmsg+" unprotected newlines");
+ bus.protectNewlines(false);
+ recus=0;
+ t2=(new java.util.Date()).getTime();
+ for (int i=0;i<n;i++ ) bus.sendMsg("coucou monde");
+ t3=(new java.util.Date()).getTime();
+ System.out.println("with protection " + (t2-t1) +"ms, without "+(t3-t2)+"ms");
+ bus.stop();
+ }
+
+}
diff --git a/tests/ProbeBench.java b/tests/ProbeBench.java
new file mode 100644
index 0000000..8884013
--- /dev/null
+++ b/tests/ProbeBench.java
@@ -0,0 +1,39 @@
+import java.io.* ;
+import fr.dgac.ivy.* ;
+
+public class ProbeBench {
+
+ public ProbeBench(int test) throws IvyException {
+ switch (test) {
+ case 1: test1(); break;
+ }
+ }
+
+ /*
+ * Tests if the Probe exits on a die message
+ */
+ public void test1() throws IvyException {
+ Probe p = new Probe(new BufferedReader(new InputStreamReader(System.in)),true,false,true);
+ Ivy bus1 = new Ivy("ProbeTest","ProbeTest ready",null);
+ bus1.start(Ivy.getDomain(null));
+ System.out.println("starting the probe");
+ p.start(bus1);
+ System.out.println("sleeping 5 seconds");
+ try { Thread.sleep(5000); } catch (InterruptedException ie) { }
+
+ Ivy bus2 = new Ivy("ProbeKiller","ProbeKiller ready",null);
+ bus2.start(Ivy.getDomain(null));
+ System.out.println("starting the probe killer");
+ new DieSender(bus2,"ProbeTest");
+ System.out.println("sleeping 5 seconds");
+ try { Thread.sleep(5000); } catch (InterruptedException ie) { }
+ bus2.stop();
+ try { System.in.close(); } catch (java.io.IOException ioe ) { }
+ System.out.println("I should leave now");
+ }
+
+ public static void main(String[] args) throws IvyException {
+ new ProbeBench(1);
+ }
+
+}
diff --git a/tests/TESTBENCH b/tests/TESTBENCH
index 9e6383e..7a4df94 100644
--- a/tests/TESTBENCH
+++ b/tests/TESTBENCH
@@ -1,4 +1,19 @@
-------------------------------------------------------------------------------
+TODO :
+ - DOC DOC DOC
+ - make run
+ - asynchronous sending ?
+ - automate all the following:
+ - test the protocol errors (broadcast, bindregexps, etc)
+ - use a parameter for the local domain address . 10.192.36 is hardcoded,
+ this is ugly
+ - check the malformed broadcasts
+ echo "coucou" | nc -u -b -q 0 127.255.255.255 2010
+ - check the remote disconnections (ivyprobe ^C ) and check if the
+ disappearance is OK
+ - propagate the testbenches to other implementations ...
+
+-------------------------------------------------------------------------------
How to check if it doesn't work ? -> There is now a simple testbench.
It can fail if the architecture doesn't support broadcast on loopback address
diff --git a/tests/TestApi.java b/tests/TestApi.java
index 4902c82..3fa936a 100644
--- a/tests/TestApi.java
+++ b/tests/TestApi.java
@@ -25,47 +25,58 @@ class TestApi implements IvyMessageListener, IvyApplicationListener {
bus.addApplicationListener(this);
bus.bindMsg("^"+TestMsg+"$",this);
bus.start(this.domain=domain);
- new Sender(domain) ;
+ bus.sendToSelf(true);
+ bus.bindMsg("^go$",new Self(domain));
+ System.out.println("sending go ...");
+ try { bus.sendMsg("go"); } catch (IvyException ie) { }
+ System.out.println("go sent");
}
public void receive(IvyClient ic,String[] args) {
- System.out.println("[X] received message");
- test++;
+ String s = "[X] received message";
+ for (int i=0;i<args.length;i++) s+=": "+args[i];
+ System.out.println(s);test++;
}
public void connect(IvyClient ic) {
if (ic.getApplicationName().compareTo("Sender")!=0) return;
- System.out.println("[X] Sender connected");
- test++;
+ System.out.println("[X] Sender connected");test++;
}
public void disconnect(IvyClient ic) {
if (ic.getApplicationName().compareTo("Sender")!=0) return;
- System.out.println("[X] Sender disconnected");
- test++;
+ System.out.println("[X] Sender disconnected");test++;
}
public void directMessage(IvyClient ic,int id,String arg) {
if (id!=1) return;
- System.out.println("[X] Direct message received, ID=1");
- test++;
+ System.out.println("[X] Direct message received, ID=1");test++;
}
- public void die(IvyClient ic,int reason) {
- System.out.println("[X] Die received");
- test++;
- System.out.println(test+ "/5 tests successful, good bye");
+ public void die(IvyClient ic,int reason,String msg) {
+ System.out.println("[X] Die received "+msg);test++;
+ System.out.println(test+" tests successful, good bye");
System.out.println("TestApi leaving the bus");
bus.stop();
System.out.println("TestApi has left");
}
+ class Self implements IvyMessageListener {
+ private String domain;
+ public Self(String domain) {this.domain=domain;}
+ public void receive(IvyClient c,String[] args){
+ System.out.println("[X] received my own go message");test++;
+ bus.sendToSelf(false);
+ new Sender(domain) ;
+ }
+ }
+
class Sender implements IvyMessageListener {
private Ivy sbus;
private String domain;
public Sender(String domain) {
try {
- System.out.println("Sender joining the bus");
+ System.out.println("starting Sender on domain "+domain);
sbus = new Ivy("Sender","Sender ready", null);
sbus.bindMsg("^"+TestApiReadyMsg+"$",this);
sbus.start(this.domain=domain);
@@ -74,8 +85,11 @@ class TestApi implements IvyMessageListener, IvyApplicationListener {
}
}
public void receive(IvyClient c,String[] args) {
- sbus.sendMsg(TestMsg);
- c.sendDirectMsg(1,"bye bye");
+ try {
+ sbus.sendMsg(TestMsg);
+ c.sendDirectMsg(1,"bye bye");
+ } catch (IvyException ie) {
+ }
System.out.println("Sender leaving the bus");
sbus.stop();
System.out.println("Sender has left the bus");
@@ -104,7 +118,7 @@ class TestApi implements IvyMessageListener, IvyApplicationListener {
}
public static void main(String[] args) throws IvyException {
- new TestApi(null);
+ new TestApi(Ivy.getDomain(null));
}
}
diff --git a/tests/TestNet.java b/tests/TestNet.java
index e65684a..d1ff968 100644
--- a/tests/TestNet.java
+++ b/tests/TestNet.java
@@ -1,12 +1,25 @@
+/**
+ * Ivy software bus tester
+ *
+ * @author Yannick Jestin <jestin@cena.fr>
+ *
+ * (c) CENA 1998-2004
+ *
+ * CHANGELOG
+ *
+ * 1.2.6
+ * goes jakarta regexp
+ */
+
import java.lang.Thread;
import java.net.*;
import java.io.*;
import java.util.StringTokenizer;
-import gnu.regexp.*;
+import org.apache.regexp.*;
import gnu.getopt.*;
class TestNet implements Runnable {
- private String domain;
+ private String mydomain;
private boolean watcherrunning = false;
private boolean isMulticastAddress = false;
private Thread broadcastListener ;
@@ -17,7 +30,7 @@ class TestNet implements Runnable {
byte buf[] = new byte[256];
DatagramPacket packet=new DatagramPacket(buf, 256);
int port;
- String s = "Server waiting for Broadcast on "+domain;
+ String s = "Server waiting for Broadcast on "+mydomain;
s+=(isMulticastAddress)?" (TCP multicast)":" (UDP broadcast)";
System.out.println(s);
while( watcherrunning ) try {
@@ -45,15 +58,9 @@ class TestNet implements Runnable {
private static String getDomain(String net) {
int sep_index = net.lastIndexOf( ":" );
if ( sep_index != -1 ) { net = net.substring(0,sep_index); }
- try {
- net += ".255.255.255";
- RE exp = new RE( "^(\\d+\\.\\d+\\.\\d+\\.\\d+).*");
- net = exp.substitute( net , "$1" );
- } catch ( REException e ){
- System.out.println("Bad broascat addr " + net);
- return null;
- }
- //System.out.println("net: "+net);
+ net += ".255.255.255";
+ RE exp = new RE( "^(\\d+\\.\\d+\\.\\d+\\.\\d+).*");
+ net = exp.subst( net , "$1" );
return net;
}
@@ -94,7 +101,7 @@ class TestNet implements Runnable {
void start(String domain) {
String domainaddr=getDomain(domain);
int port=getPort(domain);
- this.domain=domainaddr+":"+port;
+ mydomain=domainaddr+":"+port;
try {
InetAddress group = InetAddress.getByName(domainaddr);
if (group.isMulticastAddress()) {