public interface HelloService {
String sayHello(String name);
}
public class HelloServiceImpl implements HelloService {
@Override
public String sayHello(String name) {
return "Hello, " + name + "!";
}
}
public class RpcServer {
public static void main(String[] args) throws Exception {
RpcServer server = new RpcServer();
server.addService(HelloService.class, new HelloServiceImpl());
server.start();
}
public void addService(Class<?> serviceInterface, Object serviceImpl) {
}
public void start() {
}
}
public class RpcClient {
public static void main(String[] args) throws Exception {
RpcClient client = new RpcClient();
HelloService helloService = client.getProxy(HelloService.class);
String result = helloService.sayHello("World");
System.out.println(result);
}
public <T> T getProxy(Class<T> interfaceClass) {
}
}
RpcServer server = new RpcServer();
server.bind("127.0.0.1", 8888);
RpcClient client = new RpcClient();
client.setServerAddress("127.0.0.1", 8888);
client.setTimeout(5000);