text: #
  # Copyright 2007-2016, Kaazing Corporation. All rights reserved.
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  # http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  
  # Autobahn test case 7.7.1
  
  # Case Description
  # Send close with valid close code 1000
  
  # Case Expectation
  # Clean close with normal or echoed code
  
  connect "tcp://localhost:8555"
  connected
  
  write "GET /echo HTTP/1.1\r\n"
  write "User-Agent: AutobahnTestSuite/0.6.1-0.8.8\r\n"
  write "Host: localhost:8555\r\n"
  write "Upgrade: WebSocket\r\n"
  write "Connection: Upgrade\r\n"
  write "Pragma: no-cache\r\n"
  write "Cache-Control: no-cache\r\n"
  write "Sec-WebSocket-Key: uVq3zSlsryimgWqPZUGOGw==\r\n"
  write "Sec-WebSocket-Version: 13\r\n"
  write "\r\n"
  
  read "HTTP/1.1 101 Web Socket Protocol Handshake\r\n"
  read "Connection: Upgrade\r\n"
  read /Date: .*\r\n/
  read "Sec-WebSocket-Accept: 6q4AuUKdx4mAmvRZwNHgRIv8ykI=\r\n"
  read "Server: Kaazing Gateway\r\n"
  read "Upgrade: WebSocket\r\n"
  read "\r\n"
  
  # Websocket close with normal closure (given close code 1000)
  write [0x88 0x82 0x68 0x57 0x80 0x68 0x6b 0xbf]
  read [0x88 0x02 0x03 0xe8]
  
  close
  closed