使用underflow对其他微服务进行rest调用



我有一个使用underflow的简单websocket服务器。

如何在此方法中使用UndertowClient对其他微服务进行HTTP调用?

有指针吗?

@OnMessage
public String onMessage(String message) {
    //Receive request -- make async micro call - Response will be sent later
    return "request received";
}

感谢

取自此处:https://github.com/undertow-io/undertow/blob/master/websockets-jsr/src/test/java/io/undertow/websockets/jsr/test/JsrWebSocketServer07Test.java


import io.undertow.websockets.utils.WebSocketTestClient;
...
WebSocketTestClient client = new WebSocketTestClient(getVersion(), new URI("ws://" + NetworkUtils.formatPossibleIpv6Address(DefaultServer.getHostAddress("default")) + ":" + DefaultServer.getHostPort("default") + "/"));
    client.connect();
    client.send(new BinaryWebSocketFrame(Unpooled.wrappedBuffer(payload)), new FrameChecker(BinaryWebSocketFrame.class, payload, latch));
    latch.getIoFuture().get();
    Assert.assertNull(cause.get());
    client.destroy();

相关内容

  • 没有找到相关文章

最新更新