public interface HelloService {
String sayHello(String name);
}
public class HelloServiceImpl implements HelloService {
@Override
public String sayHello(String name) {
return "Hello, " + name + "!";
}
}
Server server = new Server();
server.registerService(HelloService.class, new HelloServiceImpl());
server.start();
Channel channel = new Channel("localhost", 8080);
HelloService service = Proxy.newProxyInstance(HelloService.class, channel);
String result = service.sayHello("BRPC Java");
System.out.println(result);