The problem is indeed that all @FunctionalInterface
s used in lambdas do not allow exceptions to be thrown, save for unchecked exceptions.
One solution is using a package of mine; with it, your code can read:
sessions.parallelStream()
.map(Session::getBasicRemote)
.forEach(Throwing.consumer(basic -> basic.sendText(message)));
return this;