public final class ServerApp {
public static void main(String[] args) throws Exception {
final Local local = new Local(22222);
local.getSocket().setSoTimeout(10);
local.addListener(new Listener() {
@Override
public void received(Event event) {
SocketAddress address = event.getAddress();
byte[] data = event.getData(true);
System.out.println(MessageFormat.format("Received {0} bytes of data from {1}.", data.length, address));