diff options
Diffstat (limited to 'example/websockets4')
-rw-r--r-- | example/websockets4/app/test/src/ExampleTests.scala | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/example/websockets4/app/test/src/ExampleTests.scala b/example/websockets4/app/test/src/ExampleTests.scala index cd33bb4..f122228 100644 --- a/example/websockets4/app/test/src/ExampleTests.scala +++ b/example/websockets4/app/test/src/ExampleTests.scala @@ -37,14 +37,12 @@ object ExampleTests extends TestSuite{ Thread.sleep(100) out ==> List("haoyi world", "haoyi hello") - var error: String = "" - val ws2 = cask.WsClient.connect("ws://localhost:8080/connect/nobody") { - case cask.Ws.Text(s) => out = s :: out - case cask.Ws.Error(t) => error += t.toString - case cask.Ws.Close(code, reason) => error += reason - } - - assert(error.contains("403")) + val ex = intercept[Exception]( + cask.WsClient.connect("ws://localhost:8080/connect/nobody") { + case _ => /*do nothing*/ + } + ) + assert(ex.getMessage.contains("403")) }finally ws.close() } } |