@@ -0,0 +1,1397 @@
+package com.ouc.cs;%0A%0Aimport java.io.ObjectInputStream;%0Aimport java.io.ObjectOutputStream;%0Aimport java.lang.reflect.InvocationHandler;%0Aimport java.lang.reflect.Proxy;%0Aimport java.net.Socket;%0Aimport java.net.InetSocketAddress;%0Aimport java.lang.reflect.Method;%0A%0A// RPC %E5%AE%A2%E6%88%B7%E7%AB%AF%E6%9C%AC%E5%9C%B0%E6%9C%8D%E5%8A%A1%E4%BB%A3%E7%90%86%0Apublic class RpcImporter%3CS%3E %7B%0A%09@SuppressWarnings(%22unchecked%22)%0A%09public S importer(final Class%3C?%3E serviceClass, final InetSocketAddress addr) %7B%0A%09%09return (S) Proxy.newProxyInstance(serviceClass.getClassLoader(),%0A%09%09%09%09new Class%3C?%3E%5B%5D %7B serviceClass.getInterfaces()%5B0%5D %7D,%0A%09%09%09%09new InvocationHandler() %7B%0A%09%09%09%09%09@Override%0A%09%09%09%09%09public Object invoke(Object proxy, Method method,%0A%09%09%09%09%09%09%09Object%5B%5D args) throws Throwable %7B%0A%09%09%09%09%09%09Socket socket = null;%0A%09%09%09%09%09%09ObjectOutputStream output = null;%0A%09%09%09%09%09%09ObjectInputStream input = null;%0A%09%09%09%09%09%09try %7B%0A%09%09%09%09%09%09%09socket = new Socket();%0A%09%09%09%09%09%09%09socket.connect(addr);%0A%09%09%09%09%09%09%09output = new ObjectOutputStream(socket.getOutputStream());%0A%09%09%09%09%09%09%09output.writeUTF(serviceClass.getName());%0A%09%09%09%09%09%09%09output.writeUTF(method.getName());%0A%09%09%09%09%09%09%09output.writeObject(method.getParameterTypes());%0A%09%09%09%09%09%09%09output.writeObject(args);%0A%09%09%09%09%09%09%09input = new ObjectInputStream(socket.getInputStream());%0A%09%09%09%09%09%09%09return input.readObject();%0A%09%09%09%09%09%09%7D finally %7B%0A%09%09%09%09%09%09%09if (socket != null)%0A%09%09%09%09%09%09%09%09socket.close();%0A%09%09%09%09%09%09%09if (output != null)%0A%09%09%09%09%09%09%09%09output.close();%0A%09%09%09%09%09%09%09if (input != null)%0A%09%09%09%09%09%09%09%09input.close();%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D);%0A%09%7D%0A%7D%0A

Create RpcImporter.java