title: How to read websocket response code through automation scripts
body: <p>Suppose I have a resource that is hosted on a websocket server, and I wish to validate the response status code <code>101</code>, after the connection is upgraded, how and which libraries to use.
  Im currently looking at <code>jayway response</code> library, when I connect to a websocket resource, initially it sends a 200 and then upgrades to 101. So code returns 200, I would like to know how this library can be used for websocket validation.<br>
  Sample code is :<br></p>
  
  <pre><code>String response =given().get()("https://www.ws.com:444/examples/websocket/snake.xhtml")
                      .getResponse().asString();
  </code></pre>
  
  <p>This returns a 200, but does not return the next response. I might sound a little rusty here, would appreciate if you folks have any idea how to extend it to get status <code>101</code> or if you have any other suggestions.</p>
  
  <p>Also, this requirement needs to be extended to handle redirection <code>30x</code> status codes as well, assume a resource is protected behind an access gateway, when a request comes for this protected resource, the gateway forwards it to identity store for verifying the user, at this time a 302 is returned, once verified, request is sent back to access gateway from where user is able to access websocket resource.</p>