public Server(int port) throws RemoteException {
registry = LocateRegistry.createRegistry(port);
}
public void publish(Class<?> iface, Object impl, Class<?>[] exportedInterfaces) throws RemoteException {
RemoteInvocationHandlerImpl handler = new RemoteInvocationHandlerImpl(impl, new HashSet<Class<?>>(
Arrays.asList(exportedInterfaces)));
registry.rebind(iface.getName(), handler);
}