Minimal message passing protocol in java