public interface MyService {
String sayHello(String name);
}
public class MyServiceImpl implements MyService {
public String sayHello(String name) {
return "Hello, " + name + "!";
}
}
Server server = new Server();
ServerConfiguration serverConfig = new ConfigurationBuilder()
.name("server")
.addEndpoint(new Endpoint("myEndpoint", "localhost", 1234))
.build();
server.start(serverConfig);
server.registerService("myService", new MyServiceImpl());
Client client = new Client();
ClientConfiguration clientConfig = new ConfigurationBuilder()
.name("client")
.addEndpoint(new Endpoint("myEndpoint", "localhost", 1234))
.build();
client.start(clientConfig);
MyService myService = client.getProxy(MyService.class, "myService");
String result = myService.sayHello("Alice");
System.out.println(result);