Error invloving WebSocket test

Hi all,

I am trying to test a WebSocket Server with gatling 1.5.3.

The code is :

package basic

import com.excilys.ebi.gatling.core.Predef._
import com.excilys.ebi.gatling.http.Predef._
import com.excilys.ebi.gatling.jdbc.Predef._
import com.excilys.ebi.gatling.http.Headers.Names._
import akka.util.duration._
import bootstrap._

class WebSocketScaleSimulation extends Simulation {

val httpConf = httpConfig
.baseURL(“ws://localhost:11111”)

val headers_1 = Map(
“Host” → “localhost”,
“Upgrade” → “WebSocket”,
“Connection” → “Upgrade”,
“Origin” → “example.com”,
“Sec-WebSocket-Key” → “dGhlIHNhbXBsZSBub25jZQ==”,
“Sec-WebSocket-Version” → “13”)

val scn = scenario(“Scenario name”)
.exec(
http(“request_1”)
.get("/chat")
.headers(headers_1)
.check(status.is(101))
).pause(1)

setUp(scn.users(10).ramp(10).protocolConfig(httpConf))
}

As you can see, it’s really simple. I am just generating a HTTP GET request to the server. However, I am getting error message of “WebSocket method must be a GET” which really confuses me.

Here is the full error message:

[ERROR] c.e.e.g.h.a.HttpRequestAction - Action HttpRequestAction crashed, forwarding user to next one
java.io.IOException: WebSocket method must be a GET
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.doConnect(NettyAsyncHttpProvider.java:894) ~[async-http-client-1.7.21.jar:na]
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.execute(NettyAsyncHttpProvider.java:880) ~[async-http-client-1.7.21.jar:na]
at com.ning.http.client.AsyncHttpClient.executeRequest(AsyncHttpClient.java:521) ~[async-http-client-1.7.21.jar:na]
at com.excilys.ebi.gatling.http.action.HttpRequestAction.execute(HttpRequestAction.scala:89) ~[gatling-http-1.5.3.jar:na]
at com.excilys.ebi.gatling.core.action.Action$$anonfun$receive$1.apply(Action.scala:31) ~[gatling-core-1.5.3.jar:na]
at com.excilys.ebi.gatling.core.action.Action$$anonfun$receive$1.apply(Action.scala:30) ~[gatling-core-1.5.3.jar:na]
at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:76) ~[scala-library-2.9.3.jar:na]
at akka.actor.Actor$class.apply(Actor.scala:318) ~[akka-actor-2.0.4.jar:2.0.4]
at com.excilys.ebi.gatling.http.action.HttpRequestAction.apply(HttpRequestAction.scala:55) ~[gatling-http-1.5.3.jar:na]
at akka.actor.ActorCell.invoke(ActorCell.scala:626) ~[akka-actor-2.0.4.jar:2.0.4]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) ~[akka-actor-2.0.4.jar:2.0.4]
at akka.dispatch.Mailbox.run(Mailbox.scala:179) ~[akka-actor-2.0.4.jar:2.0.4]
at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:516) [akka-actor-2.0.4.jar:2.0.4]
at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259) [akka-actor-2.0.4.jar:2.0.4]
at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975) [akka-actor-2.0.4.jar:2.0.4]
at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1479) [akka-actor-2.0.4.jar:2.0.4]
at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) [akka-actor-2.0.4.jar:2.0.4]

Does anyone know how to solve this problem?

Thanks in advance,
Yanan

Gatling 1 doesn’t have official WebSocket support, you’d need a third party: https://github.com/excilys/gatling/wiki/Third-parties
This was contributed and will be shipped in Gatling 2 next milestone.