anchor.diff:           get_rid/1,
            get_keepalive/1,
            set_keepalive/2,
  -         pause/2]).
  +         pause/2,
  +         get_active/1,
  +         set_active/2,
  +         recv/1]).
   
   -define(WAIT_FOR_SOCKET_CLOSE_TIMEOUT, 200).
   -define(SERVER, ?MODULE).
  
positive.code:                 rid = nil,
                  requests = 0,
                  keepalive = true,
                  wait}).
  
  %%%===================================================================
  %%% API
  
negative.code:             #state{keepalive = Keepalive} = State) ->
      {reply, {ok, Keepalive, NewKeepalive},
       State#state{keepalive = NewKeepalive}};
  
  handle_call(get_active, _From, #state{active = Active} = State) ->
      {reply, Active, State};
  handle_call({set_active, Active}, _From, State) ->
      {reply, ok, State#state{active = Active}};
  
  handle_call(recv, _From, State) ->
      {Reply, NS} = handle_recv(State),
      {reply, Reply, NS};
  
  handle_call(stop, _From, #state{} = State) ->
      StreamEnd = escalus_stanza:stream_end(),
      NewState = send0(transport(State), exml:to_iolist(StreamEnd), State),
  