anchor.diff:  	decode_envelope(aes_decrypt(Packet, State)).
   
   %% ------------------------------------------------------------------
  +
  +handle_connect_message(Packet, State) ->
  +	#state{cookie = Cookie} = State,
  +	try begin
  +		% Decrypt message envelope
  +		Rec = aes_decrypt_envelope(Packet, State),
  +		#envelope{type = request, channel = <<"control">>, id = MsgID, contents = {struct, Request}} = Rec,
  +		case proplists:get_value(<<"type">>, Request) of
  +			<<"connect">> ->
  +				case proplists:get_value(<<"cookie">>, Request) of
  +					Cookie -> ok;
  +					_ -> badcookie
  +				end;
  +			_ -> badrequest
  +		end end,
  +		% Send response over SSL transport
  +		ConnectRep = {struct, [
  +			{confirm, true}
  +		]},
  +		Response = #envelope{type = response, channel = <<"control">>, id = MsgID, contents = ConnectRep},
  +		OutBin = wrap_for_send(Response),
  +		SendRes = ssl:send(State#state.ssl_socket, OutBin),
  +		?debug("Connect response ssl:send result:  ~p", [SendRes])
  +	catch
  +		What:Why ->
  +			{What,Why}
  +	end.
  +
  +%% ------------------------------------------------------------------
   %% Tests
   %% ------------------------------------------------------------------
   
  
positive.code: 
  handle_info({udp, Socket, Ip, InPortNo, Packet},
  	#state{udp_socket = Socket, udp_remote_info = undefined} = State) ->
  		#state{cookie = Cookie} = State,
  		Success = try begin
  			% Decrypt message envelope
  			Rec = aes_decrypt_envelope(Packet, State),
  			#envelope{type = request, channel = <<"control">>, id = MsgID, contents = {struct, Request}} = Rec,
  			case proplists:get_value(<<"type">>, Request) of
  				<<"connect">> ->
  					case proplists:get_value(<<"cookie">>, Request) of
  						Cookie -> ok;
  						_ -> badcookie
  					end;
  				_ -> badrequest
  			end end,
  			% Send response over SSL transport
  			ConnectRep = {struct, [
  				{confirm, true}
  			]},
  			Response = #envelope{type = response, channel = <<"control">>, id = MsgID, contents = ConnectRep},
  			OutBin = wrap_for_send(Response),
  			SendRes = ssl:send(State#state.ssl_socket, OutBin),
  			?debug("UDP connection response ssl:send result:  ~p", [SendRes])
  		catch
  			What:Why ->
  				{What,Why}
  		end,
  		case Success of
  			ok ->
  				% Record this client's information in ETS
  
negative.code: 
  handle_info(Info, State) ->
  	?debug("unhandled info:  ~p (~p)", [Info, State]),
  	{noreply, State}.
  
  %% ------------------------------------------------------------------
  %% terminate
  %% ------------------------------------------------------------------
  
  terminate(_Reason, _State) ->
  	ok.
  
  %% ------------------------------------------------------------------
  %% code_change
  %% ------------------------------------------------------------------
  
  code_change(_OldVsn, State, _Extra) ->
  	{ok, State}.
  
  %% ------------------------------------------------------------------
  %% Internal Function Definitions
  