WebTau websocket module lets your send, receive and validate websocket messages in a convenient synchronous manner. Groovy def wsSession = websocket.connect("/prices") wsSession.send([symbol: "IBM"]) wsSession.received.waitTo == [ price: greaterThan(100), symbol: "IBM"] wsSession.close() Java var wsSession = websocket.connect("/prices"); wsSession.send(map("symbol", "IBM")); wsSession.received.waitTo(equal(map( "price", greaterThan(100), "symbol", "IBM"))); wsSession.close(); > connecting to websocket /prices . connected to websocket ws://localhost:46359/prices (8ms) > sending text message to ws://localhost:46359/prices {"symbol": "IBM"} . sent text message to ws://localhost:46359/prices (1ms) > waiting for received from ws://localhost:46359/prices to equal {"price": <greater than 100>, "symbol": "IBM"} > [1/25] polling websocket message {"symbol": "IBM", "price": 77} . [1/25] polled new message (0ms) > [25/25] polling websocket message {"symbol": "IBM", "price": 101} . [25/25] polled new message (0ms) . received from ws://localhost:46359/prices equals {"price": <greater than 100>, "symbol": "IBM"} (214ms) > closing websocket ws://localhost:46359/prices . closed websocket ws://localhost:46359/prices (0ms)