anchor.diff:  -define(WD_EVENT(Ref), log_wd(element(4, ?EVENT({watchdog, Ref, _, _, _})))).
   
   %% Log to make failures identifiable.
  --define(LOG(T),   ?LOG("~p", [T])).
  --define(LOG(F,A), ct:pal("~p: " ++ F, [self() | A])).
  +-define(LOG(T),     ?LOG("~p", [T])).
  +-define(LOG(F,A),   ct:pal("~p: " ++ F, [self() | A])).
  +-define(WARN(F,A),  ct:pal(error, "~p: " ++ F, [self() | A])).
   
   %% ===========================================================================
   
   suite() ->
  -    [{timetrap, {minutes, 5}}]. %% 20 watchdogs @ 15 sec
  +    [{timetrap, {seconds, 90}}].
   
   all() ->
  -    [reopen].
  +    [reopen,
  +     suspect,
  +     okay].
   
   init_per_suite(Config) ->
       ok = diameter:start(),
  
positive.code: %% reopen/6
  
  reopen(Type, Test, Ref, Wd, N, M) ->
      {SvcName, TRef} = start(Type, Ref, opts(Type, Test, Ref, Wd)),
      reopen(Type, Test, SvcName, TRef, Wd, N, M).
  
  %% start/3
  
  start(Type, Ref, Opts) ->
      Name = hostname(),
      true = diameter:subscribe(Name),
      ok = diameter:start_service(Name, [{monitor, self()} | ?SERVICE(Name)]),
      {ok, TRef} = diameter:add_transport(Name, {Type, Opts}),
      true = diameter_reg:add_new({Type, Ref, Name}),
      {Name, TRef}.
  
  opts(Type, Test, Ref, Wd) ->
      {Timer, Counts, Mod} = opts(Type, Test, Wd),
      [{transport_module, diameter_tcp},
       {transport_config, Mod ++ [{ip, ?ADDR}, {port, 0}] ++ cfg(Type, Ref)},
       {watchdog_timer, Timer},
       {watchdog_counts, Counts}].
  
  cfg(listen, _) ->
      [];
  cfg(connect, Ref) ->
      [{{_, _, SvcName}, _Pid}] = diameter_reg:wait({listen, Ref, '_'}),
      [[{ref, LRef} | _]] = diameter:service_info(SvcName, transport),
      [LP] = ?util:lport(tcp, LRef, 20),
      [{raddr, ?ADDR}, {rport, LP}].
  
  opts(Type, Type, Wd) ->
      {Wd, [], []};
  opts(_Type, _Test, _Wd) ->
      {?WD(?PEER_WD), [{open, 0}], [{module, ?MODULE}]}.
  
  %% reopen/7
  
  %% The watchdog to be tested.
  reopen(Type, Type, SvcName, Ref, Wd, N, M) ->
      ?LOG("node, ~p, ~p", [Type, Ref]),
  
      %% Connection should come up immediately as a consequence of
      %% starting the watchdog process. In the accepting case this
  
negative.code:          end_per_suite/1]).
  
  %% testcases
  -export([reopen/0, reopen/1, reopen/4, reopen/6,
           suspect/1, suspect/4,
           okay/1, okay/4]).
  
  -export([id/1,    %% jitter callback
           run1/1,
           abuse/1,
           abuse/2]).
  
  %% diameter_app callbacks
  -export([peer_up/3,
  