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:33587/prices (6ms) > sending text message to ws://localhost:33587/prices {"symbol": "IBM"} . sent text message to ws://localhost:33587/prices (0ms) > waiting for received from ws://localhost:33587/prices to equal {"price": <greater than 100>, "symbol": "IBM"} > [1/25] polling websocket message {"symbol": "IBM", "price": 77} . [1/25] polled new message (1ms) > [25/25] polling websocket message {"symbol": "IBM", "price": 101} . [25/25] polled new message (1ms) . received from ws://localhost:33587/prices equals {"price": <greater than 100>, "symbol": "IBM"} (206ms) > closing websocket ws://localhost:33587/prices . closed websocket ws://localhost:33587/prices (0ms)