catch (RemoteException ex) {
fail("RemoteException not expected");
}
// Test with server
Server server = FACTORY.createServer(1099, LANG);
try {
client.connect(null, "localhost", "1099", "test", LANG);
System.out.println("Connect to localhost on port 1099");
}
catch (RemoteException ex) {
fail("RemoteException was not expected");
}
catch (NotBoundException ex) {
fail("NotBoundException was not expected");
}
catch (MalformedURLException ex) {
fail("MalformedURLException was not expected");
}
// Connect with bad adress
try {
client.connect(null, "test", "1099", "test", LANG);
fail("Connect to bad address not expected");
}
catch (RemoteException ex) {
System.out.println("Can't connect to bad address");
}
catch (NotBoundException ex) {
fail("NotBoundException was not expected");
}
catch (MalformedURLException ex) {
fail("MalformedURLException was not expected");
}
// Connect with bad port
try {
client.connect(null, "localhost", "22", "test", LANG);
fail("Connect to localhost on port 22 not expected");
}
catch (RemoteException ex) {
System.out.println("Can't connect on port 22");
}
catch (NotBoundException ex) {
fail("NotBoundException was not expected");
}
catch (MalformedURLException ex) {
fail("MalformedURLException was not expected");
}
//50 connections/disconnections
System.out.println("50 Connections/disconnections...");
for (int i = 0; i < 50; i++) {
try {
client.connect(null, "localhost", "1099", "test" + i, LANG);
server.disconnect(0);
}
catch (RemoteException ex) {
fail("RemoteException was not expected");
}
catch (NotBoundException ex) {