I have this piece of code:
private void handleReceivedMessage(String m) throws IOException {
switch(m) {
case "ping":
// code block
ping();
break;
default:
System.out.println("message not understood");
}
}
public DataServer(int port) throws IOException {
server = new Server(port, this::handleReceivedMessage);
server.acceptClient();
}
now I get the error at the line this::handleReceivedMessage: Unhandled exception: java.io.IOException
How do I solve this? It's clear that the handleReceivedMessage functions does throw an IOException