It looks like you have a syntax error in your code. Your are trying to define the lambda expression within an anonymous inner class. However, you should use the lambda expression instead of the anonymous inner class. I guess the following works:
SocketServer server = SocketFactory.create().addListener(8888, "localhost")
.setHandler(e -> { e.send("Hello World"); }).create();
If the method setHandler
is overloaded, it might be necessary to provide more information, e.g. by adding a cast:
SocketServer server = SocketFactory.create().addListener(8888, "localhost")
.setHandler((SocketHandler) e -> { e.send("Hello World"); }).create();