Hi,
i added a SockJS eventbus bridge route to my verticle according to:
The JavaScript Client example works just fine but i want to write java unit tests in order to test my implementation. Is there a way to connect to the SockJS eventbus websocket via java?
I tried to use the vertx http client:
HttpClient client = vertx.createHttpClient();
client.websocket(8080, "localhost", "/eventbus/382/149qpk4q/websocket", websocket -> {
websocket.handler(data -> {
System.out.println("Received data " + data.toString("ISO-8859-1"));
client.close();
});
});
But all i get is:
Received data o
10:23:11.324 [Astonished Arcanine] DEBUG [vert.x-eventloop-thread-0] [Slf4JLogger.java:71] - Encoding WebSocket Frame opCode=8 length=2
10:23:11.324 [Astonished Arcanine] DEBUG [vert.x-eventloop-thread-0] [Slf4JLogger.java:71] - Encoding WebSocket Frame opCode=8 length=2
io.netty.handler.codec.DecoderException: io.netty.util.IllegalReferenceCountException: refCnt: 0
I assume the sockjs vertx eventbus messages are encoded in a special way? Any ideas?
- Johannes