home *** CD-ROM | disk | FTP | other *** search
Java Source | 2003-04-29 | 908 b | 46 lines |
- package com.jproxy.samples.rmi.test;
-
- import javax.naming.*;
- import java.rmi.*;
- import java.util.*;
-
- import com.jproxy.samples.interfaces.ITest;
-
- public class TestServer
- {
- public static void main(String[] args)
- {
- // System.setSecurityManager(new RMISecurityManager());
-
- try {
- // Create object to be bound
- ITest test = new TestImpl();
-
- // Create the initial context
- InitialContext context = new InitialContext();
-
- context.rebind("test", test);
-
- test = (ITest) context.lookup("test");
-
- System.out.println(
- "\r\n**********************************"+
- "\r\nRMI Test "+
- "\r\nServer Time: "+(new Date(test.getServerTime()))+
- "\r\nServer started. "+
- "\r\n**********************************\r\n");
-
- // Close the context
- context.close();
- }
- catch (NamingException e)
- {
- e.printStackTrace();
- }
- catch (RemoteException e)
- {
- e.printStackTrace();
- }
- }
- }
-