I use Gatling 2.1.7 to test our websocket server
I copied the sample code and changed a little as follows
class WebsocketSimulation extends Simulation{
val httpConf = http
.baseURL(“https://xxx”)
.acceptHeader(“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”)
.doNotTrackHeader(“1”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.acceptEncodingHeader(“gzip, deflate”)
.userAgentHeader(“Gatling2”)
.wsBaseURL(“wss://xxx”)val scn = scenario(“WebSocket”)
.exec(session => session.set(“sk”, “63ff221c1b1a0797afa5130cbbbaa8a6153cac830ff”))
.exec(ws(“Connect WS”).open(“/websocket/message?securityKey=${sk}”))
.pause(1)
.exec(ws(“Close WS”).close)setUp(scn.inject(atOnceUsers(1)).protocols(httpConf))
}
But when I ran gatling.sh, I got the following output:
2016-03-31 13:01:13 3s elapsed
---- WebSocket -----------------------------------------------------------------
[##########################################################################]100%
waiting: 0 / active: 0 / done:1
---- Requests ------------------------------------------------------------------
> Global (OK=1 KO=1 )
> Connect WS (OK=1 KO=0 )
> Close WS (OK=0 KO=1 )
---- Errors --------------------------------------------------------------------
> Websocket 'gatling.http.webSocket' was unexpectedly closed wit 1 (100.0%)
h status 4003 and message Invalid security key.
What happened? It seems that the websocket connection isn't closed although I invoked *ws("Close WS").close* method.
Can anyone give some advice?
Thanks in advance