anchor.diff:  %%%===================================================================
   %%% Internal functions
   %%%===================================================================
  -handle_call(From, {set_opts, Opts}, StateName, #data{socket_options = SockOpts} = StateData) ->
  -    {next_state, StateName, StateData#data{socket_options = set_opts(SockOpts, Opts)}, [{reply, From, ok}]}.
  -        
  -handle_info({'DOWN', Monitor, _, _, Reason}, _, 
  -            #data{connection_monitor = Monitor,
  -                  dist_handle = Handle} = StateData) when Handle =/= undefined->
  -    {next_state, death_row, StateData, [{state_timeout, 5000, Reason}]};
  -handle_info({'DOWN', Monitor, _, _, _}, _, 
  -            #data{connection_monitor = Monitor} = StateData) ->
  +
  +handle_set_opts(
  +  From, Opts, #data{socket_options = SockOpts} = StateData) ->
  +    {keep_state, StateData#data{socket_options = set_opts(SockOpts, Opts)},
  +     [{reply, From, ok}]}.
  +
  +handle_common(
  +  {call, From}, {set_opts, Opts},
  +  #data{socket_options = SockOpts} = StateData) ->
  +    {keep_state, StateData#data{socket_options = set_opts(SockOpts, Opts)},
  +     [{reply, From, ok}]};
  +handle_common(
  +  info, {'DOWN', Monitor, _, _, Reason},
  +  #data{connection_monitor = Monitor,
  +        dist_handle = Handle} = StateData) when Handle =/= undefined ->
  +    {next_state, death_row, StateData,
  +     [{state_timeout, 5000, Reason}]};
  +handle_common(
  +  info, {'DOWN', Monitor, _, _, _},
  +  #data{connection_monitor = Monitor} = StateData) ->
       {stop, normal, StateData};
  -handle_info(_,_,_) ->
  +handle_common(info, Msg, _) ->
  +    Report =
  +        io_lib:format("TLS sender: Got unexpected info: ~p ~n", [Msg]),
  +    error_logger:info_report(Report),
  +    keep_state_and_data;
  +handle_common(Type, Msg, _) ->
  +    Report =
  +        io_lib:format(
  +          "TLS sender: Got unexpected event: ~p ~n", [{Type,Msg}]),
  +    error_logger:error_report(Report),
       keep_state_and_data.
   
   send_tls_alert(Alert, #data{negotiated_version = Version,
  
positive.code:       end};
  connection(info, tick, StateData) ->  
      consume_ticks(),
      {next_state, ?FUNCTION_NAME, StateData, 
       [{next_event, {call, {self(), undefined}},
         {application_data, <<>>}}]};
  connection(info, {send, From, Ref, Data}, _StateData) -> 
      %% This is for testing only!
      %%
  
negative.code:                         negotiated_version = Version,
                          renegotiate_at = RenegotiateAt},          
      {next_state, handshake, StateData, [{reply, From, ok}]};
  init(_, _, _) ->
      %% Just in case anything else sneeks through
      {keep_state_and_data, [postpone]}.
  
  %%--------------------------------------------------------------------
  -spec connection(gen_statem:event_type(),
             Msg :: term(),
             StateData :: term()) ->
                    gen_statem:event_handler_result(atom()).
  %%--------------------------------------------------------------------
  connection({call, From}, {application_data, AppData}, 
             #data{socket_options = #socket_options{packet = Packet}} =
                 StateData) ->
  