apache zeppelin 编程测试。 Websockets 调用
apache zeppelin programmatic test. Websockets calls
正在尝试使用 spring websocet 库连接到 zeppelin,运行 默认端口 8080。
当我使用时:
ClientWebSocketContainer container = new ClientWebSocketContainer(
webSocketClient(), "ws://localhost:8080");
获取错误:
java.io.IOException: Connect failure
at org.eclipse.jetty.websocket.jsr356.ClientContainer.connect(ClientContainer.java:157) ~[javax-websocket-client-impl-9.2.14.v20151106.jar:9.2.14.v20151106]
at org.eclipse.jetty.websocket.jsr356.ClientContainer.connectToServer(ClientContainer.java:180) ~[javax-websocket-client-impl-9.2.14.v20151106.jar:9.2.14.v20151106]
at org.springframework.web.socket.client.standard.StandardWebSocketClient.call(StandardWebSocketClient.java:152) ~[spring-websocket-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.web.socket.client.standard.StandardWebSocketClient.call(StandardWebSocketClient.java:149) ~[spring-websocket-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_111]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_111]
Caused by: org.eclipse.jetty.websocket.api.UpgradeException: Didn't switch protocols
at org.eclipse.jetty.websocket.client.io.UpgradeConnection.validateResponse(UpgradeConnection.java:314) ~[websocket-client-9.2.14.v20151106.jar:9.2.14.v20151106]
at org.eclipse.jetty.websocket.client.io.UpgradeConnection.read(UpgradeConnection.java:241) ~[websocket-client-9.2.14.v20151106.jar:9.2.14.v20151106]
at org.eclipse.jetty.we...
当我尝试连接到 8081 时(文档说的是 websocket 端口):
java.net.ConnectException: 连接被拒绝
在 sun.nio.ch.SocketChannelImpl.checkConnect(本机方法)~[na:1.8.0_111]
在 sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_111]
在 org.eclipse.jetty.io.SelectorManager.finishConnect(SelectorManager.java:340) ~[jetty-io-9.2.14.v20151106.jar:9.2.14.v20151106]
在浏览器上我可以连接到 8080 而不是做笔记本。
想要为我们的笔记本自动化和编写测试用例。
我猜你的 ws url 有点格式错误,你可以试试 ws://localhost:8080/ws
吗?
更新:
Zeppelin 代码库本身也有类似的示例,例如获取注释。例如here the method for getting note and here is the crafted message that is sent via ws api. Also this class指向套接字消息结构。
正在尝试使用 spring websocet 库连接到 zeppelin,运行 默认端口 8080。
当我使用时:
ClientWebSocketContainer container = new ClientWebSocketContainer(
webSocketClient(), "ws://localhost:8080");
获取错误:
java.io.IOException: Connect failure at org.eclipse.jetty.websocket.jsr356.ClientContainer.connect(ClientContainer.java:157) ~[javax-websocket-client-impl-9.2.14.v20151106.jar:9.2.14.v20151106] at org.eclipse.jetty.websocket.jsr356.ClientContainer.connectToServer(ClientContainer.java:180) ~[javax-websocket-client-impl-9.2.14.v20151106.jar:9.2.14.v20151106] at org.springframework.web.socket.client.standard.StandardWebSocketClient.call(StandardWebSocketClient.java:152) ~[spring-websocket-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.web.socket.client.standard.StandardWebSocketClient.call(StandardWebSocketClient.java:149) ~[spring-websocket-4.2.3.RELEASE.jar:4.2.3.RELEASE] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_111] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_111] Caused by: org.eclipse.jetty.websocket.api.UpgradeException: Didn't switch protocols at org.eclipse.jetty.websocket.client.io.UpgradeConnection.validateResponse(UpgradeConnection.java:314) ~[websocket-client-9.2.14.v20151106.jar:9.2.14.v20151106] at org.eclipse.jetty.websocket.client.io.UpgradeConnection.read(UpgradeConnection.java:241) ~[websocket-client-9.2.14.v20151106.jar:9.2.14.v20151106] at org.eclipse.jetty.we...
当我尝试连接到 8081 时(文档说的是 websocket 端口):
java.net.ConnectException: 连接被拒绝 在 sun.nio.ch.SocketChannelImpl.checkConnect(本机方法)~[na:1.8.0_111] 在 sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_111] 在 org.eclipse.jetty.io.SelectorManager.finishConnect(SelectorManager.java:340) ~[jetty-io-9.2.14.v20151106.jar:9.2.14.v20151106]
在浏览器上我可以连接到 8080 而不是做笔记本。
想要为我们的笔记本自动化和编写测试用例。
我猜你的 ws url 有点格式错误,你可以试试 ws://localhost:8080/ws
吗?
更新: Zeppelin 代码库本身也有类似的示例,例如获取注释。例如here the method for getting note and here is the crafted message that is sent via ws api. Also this class指向套接字消息结构。