anchor.diff:  -module(do_handshake).
  --export([setup/0, teardown/1, given/3, then/3]).
  +
  +%-export([setup/0, teardown/1, given/3, then/3]).
  +-compile([export_all]).
   
   setup()->
  -  start_http_server(8080),
  +  start_http_server(self(), 8080),
     ok.
   
   teardown(_State) ->
  
positive.code:        ],
         gen_tcp:send(Socket, HandShake),
        wait(Socket)
    end.
  
  'Sec-WebSocket-Key'(Packet) ->
  
negative.code: % Mock a http server
  %
  
  start_http_server(Tester, Port) ->
    {ok, Listen} = gen_tcp:listen(Port, [{reuseaddr, true}, {packet, raw}, binary]),
    spawn_link(fun() -> accept(Tester, Listen) end).
  
  accept(Tester, Listen) ->
    {ok, Socket} = gen_tcp:accept(Listen),
   handshake(Tester, Socket).
  
  handshake(Tester, Socket) ->
    receive
      {tcp, Socket, Data } ->
        {ok, {http_request, 'GET', _Uri, _Version}, Rest} = erlang:decode_packet(http, Data, []),
  
        Headers = headers(Rest, []),
        %io:format("Hewders ~w ~n", [_Headers]),
        Tester ! {headers, Headers},
        _SecWebSocketKey = 'Sec-WebSocket-Key'(Rest),
        HandShake = [
          "HTTP/1.1 101 Web Socket Protocol Handshake\r\n",
          "Upgrade: WebSocket\r\n",
  