Add Comet.whenConnected for Java 8

Add Java 8 lambda-friendly factory method to Comet, similar to EventSource. With tests.