//server
    public static void main(String[] args) {
        try {
            Registry reg = LocateRegistry.createRegistry(Registry.REGISTRY_PORT
//                    , new SslRMIClientSocketFactory()
//                    , new SslRMIServerSocketFactory()
                    );
            reg.bind(SmallWorld.NAME, new SmallWorldImpl());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }//client
    public static void main(String[] args) {
        try {
            Registry reg = LocateRegistry.getRegistry(
//                    "127.0.0.1",
                    Registry.REGISTRY_PORT
//                    ,new SslRMIClientSocketFactory()
                    );
            SmallWorld he = (SmallWorld) Naming.lookup(SmallWorld.NAME);
            System.out.println(he.hello(4));
            System.out.println(he.hello(8));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
为啥将注释去掉就出错了java.rmi.ConnectIOException: non-JRMP server at remote endpoint
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:230)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:84)
at test.Test.main(Test.java:25)public interface SmallWorld extends java.rmi.Remote 
{
    public static final String NAME = "SmallWorld"; 
    public String hello(int i) throws java.rmi.RemoteException; 
}
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
public class SmallWorldImpl extends UnicastRemoteObject implements SmallWorld 

    public SmallWorldImpl() throws RemoteException { 
        super(); 
    } 
    @Override
    public String hello(int i) throws java.rmi.RemoteException 
    { 
        System.out.println("In SmallWorldImpl i = " + i); 
        return ("Hello number=" + i); 
    } 
}