public class ServerApp {
public static void main(String[] args) throws Exception {
Endpoint endpoint = new Endpoint(22222);
endpoint.addEndpointDataListener(new EndpointDataListener() {
@Override
public void received(EndpointDataEvent event) {
System.out.println("Received " + new String(event.getData()) + ", from " + event.getAddress());
}
});