Je suis debutant java.rmi je viens de trouver n ptit exemple sur le net j'aimerai bien savoire comment je peut le tester?

sujet : le serveur envoye une chaine de caractere au client.
probleme : le client ne recois pas la chaine.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package test_rmi;
 
import java.applet.*;
import java.awt.*;
import java.rmi.*;
 
public class AppletTestRMI extends Applet {
	private String s;
	public void init() {
		try {
			Remote r = Naming.lookup("rmi://127.0.0.1/TestRMI");
			if (r instanceof Information) {
				s = ((Information) r).getInformation();
			}
		} catch (Exception e) {  }
	}
	public void paint(Graphics g) {
		super.paint(g);
		g.drawString("chaine retournée = "+s,20,20);
	}
}
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package test_rmi;
 
import java.rmi.*;
import java.rmi.server.*;
 
public class TestRMIServer extends UnicastRemoteObject implements Information {
	protected TestRMIServer() throws RemoteException {
		super();
    }
    public String getInformation()throws RemoteException {
       return "bonjour";
    }
    public static void main(String[] args) {
    	try {
    		java.rmi.registry.LocateRegistry.createRegistry(1099);
    		System.out.println("Mise en place du Security Manager ...");
    		System.setSecurityManager(new java.rmi.RMISecurityManager());
    		TestRMIServer testRMIServer = new TestRMIServer();
    		System.out.println("Enregistrement du serveur");
    		//Naming.rebind("rmi://"+java.net.InetAddress.getLocalHost() + "/TestRMI", testRMIServer);
    		Naming.rebind("rmi://localhost/TestRMI", testRMIServer);
    	}
    	catch (Exception e) { System.out.println("Exception capturée: " + e.getMessage()); }
    }
}
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
package test_rmi;
 
import java.rmi.*;
public interface Information extends Remote {
	public String getInformation() throws RemoteException;
}