anchor.diff:  
   -ifdef(EUNIT).
   
  -fetch_id({dict, Params}) ->
  -    proplists:get_value({string, "id"}, Params).
  +fetch_id(Params) ->
  +    get_value(<<"id">>, Params).
   
   query_ping_0_test() ->
      Enc = "d1:ad2:id20:abcdefghij0123456789e1:q4:ping1:t2:aa1:y1:qe",
      {ping, ID, Params} = decode_msg(Enc),
      ?assertEqual(<<"aa">>, ID),
  -   ?assertEqual({string, "abcdefghij0123456789"}, fetch_id(Params)).
  -
  -%% query_find_node_0_test() ->
  -%%    Enc = "d1:ad2:id20:abcdefghij01234567896:"
  -%%        ++"target20:mnopqrstuvwxyz123456e1:q9:find_node1:t2:aa1:y1:qe",
  -%%    Res = decode_msg(Enc),
  -%%    {dht_query, find_node, ID, Params} = Res,
  -%%    ?assertEqual(<<"aa">>, ID),
  -%%    ?assertEqual(<<"abcdefghij0123456789">>, fetch_id(Params)),
  -%%    ?assertEqual(<<"mnopqrstuvwxyz123456">>, fetch_target(Params)).
  -
  -%% query_get_peers_0_test() ->
  -%%    Enc = "d1:ad2:id20:abcdefghij01234567899:info_hash"
  -%%        ++"20:mnopqrstuvwxyz123456e1:q9:get_peers1:t2:aa1:y1:qe",
  -%%    Res = decode_msg(Enc),
  -%%    {dht_query, get_peers, ID, Params} = Res,
  -%%    ?assertEqual(<<"aa">>, ID),
  -%%    ?assertEqual(<<"abcdefghij0123456789">>, fetch_id(Params)),
  -%%    ?assertEqual(<<"mnopqrstuvwxyz123456">>, fetch_info_hash(Params)).
  -
  -%% query_announce_peer_0_test() ->
  -%%    Enc = "d1:ad2:id20:abcdefghij01234567899:info_hash20:"
  -%%        ++"mnopqrstuvwxyz1234564:porti6881e5:token8:aoeusnthe1:"
  -%%        ++"q13:announce_peer1:t2:aa1:y1:qe",
  -%%    Res = decode_msg(Enc),
  -%%    {dht_query, announce, ID, Params} = Res,
  -%%    ?assertEqual(<<"aa">>, ID),
  -%%    ?assertEqual(<<"abcdefghij0123456789">>, fetch_id(Params)),
  -%%    ?assertEqual(<<"mnopqrstuvwxyz123456">>, fetch_info_hash(Params)),
  -%%    ?assertEqual(6881, fetch_port(Params)),
  -%%    ?assertEqual(<<"aoeusnth">>, fetch_token(Params)).
  -
  -%% resp_ping_0_test() ->
  -%%    Enc = "d1:rd2:id20:mnopqrstuvwxyz123456e1:t2:aa1:y1:re",
  -%%    Res = bencode_to_response(Enc),
  -%%    {dht_response, ID, Values} = Res,
  -%%    ?assertEqual(<<"aa">>, ID),
  -%%    ?assertEqual(<<"mnopqrstuvwxyz123456">>, fetch_id(Values)).
  -
  -%% resp_find_peer_0_test() ->
  -%%    Enc = "d1:rd2:id20:0123456789abcdefghij5:nodes0:e1:t2:aa1:y1:re",
  -%%    Res = bencode_to_response(Enc),
  -%%    {dht_response, ID, Values} = Res,
  -%%    ?assertEqual(<<"aa">>, ID),
  -%%    ?assertEqual(<<"0123456789abcdefghij">>, fetch_id(Values)),
  -%%    ?assertEqual([], fetch_nodes(Values)).
  -
  -%% resp_find_peer_1_test() ->
  -%%    Enc = "d1:rd2:id20:0123456789abcdefghij5:nodes6:"
  -%%        ++ [0,0,0,0,0,0] ++ "e1:t2:aa1:y1:re",
  -%%    Res = bencode_to_response(Enc),
  -%%    {dht_response, ID, Values} = Res,
  -%%    ?assertEqual(<<"aa">>, ID),
  -%%    ?assertEqual(<<"0123456789abcdefghij">>, fetch_id(Values)),
  -%%    ?assertEqual([{{0,0,0,0}, 0}], fetch_nodes(Values)).
  -
  -%% resp_get_peers_0_test() ->
  -%%    Enc = "d1:rd2:id20:abcdefghij01234567895:token8:aoeusnth6:valuesl6:axje.u6:idhtnmee1:t2:aa1:y1:re",
  -%%    Res = bencode_to_response(Enc),
  -%%    {dht_response, ID, Values} = Res,
  -%%    ?assertEqual(<<"aa">>, ID),
  -%%    ?assertEqual(<<"abcdefghij0123456789">>, fetch_id(Values)),
  -%%    ?assertEqual(<<"aoeusnth">>, fetch_token(Values)),
  -%%    ?assertEqual({true, [{{97,120,106,101},11893}, {{105,100,104,116}, 28269}]}, fetch_peers(Values)).
  -
  -%% resp_get_peers_1_test() ->
  -%%    Enc = "d1:rd2:id20:abcdefghij01234567895:nodes6:def4565:token8:aoeusnthe1:t2:aa1:y1:re",
  -%%    Res = bencode_to_response(Enc),
  -%%    {dht_response, ID, Values} = Res,
  -%%    ?assertEqual(<<"aa">>, ID),
  -%%    ?assertEqual(<<"abcdefghij0123456789">>, fetch_id(Values)),
  -%%    ?assertEqual(<<"aoeusnth">>, fetch_token(Values)),
  -%%    ?assertEqual({false, [{{100,101,102,52},13622}]}, fetch_peers(Values)).
  -
  -%% resp_announce_peer_0_test() ->
  -%%    Enc = "d1:rd2:id20:mnopqrstuvwxyz123456e1:t2:aa1:y1:re",
  -%%    Res = bencode_to_response(Enc),
  -%%    {dht_response, ID, {dict, Values}} = Res,
  -%%    ?assertEqual(<<"aa">>, ID),
  -%%    ?assertEqual(<<"mnopqrstuvwxyz123456">>, proplist:get_value("id", Values)).
  +   ?assertEqual(<<"abcdefghij0123456789">>, fetch_id(Params)).
  +
  +query_find_node_0_test() ->
  +    Enc = "d1:ad2:id20:abcdefghij01234567896:"
  +        ++"target20:mnopqrstuvwxyz123456e1:q9:find_node1:t2:aa1:y1:qe",
  +    Res = decode_msg(Enc),
  +    {find_node, ID, Params} = Res,
  +    ?assertEqual(<<"aa">>, ID),
  +    ?assertEqual(<<"abcdefghij0123456789">>, fetch_id(Params)),
  +    ?assertEqual(<<"mnopqrstuvwxyz123456">>, get_value(<<"target">>, Params)).
  +
  +query_get_peers_0_test() ->
  +    Enc = "d1:ad2:id20:abcdefghij01234567899:info_hash"
  +        ++"20:mnopqrstuvwxyz123456e1:q9:get_peers1:t2:aa1:y1:qe",
  +    Res = decode_msg(Enc),
  +    {get_peers, ID, Params} = Res,
  +    ?assertEqual(<<"aa">>, ID),
  +    ?assertEqual(<<"abcdefghij0123456789">>, fetch_id(Params)),
  +    ?assertEqual(<<"mnopqrstuvwxyz123456">>, get_value(<<"info_hash">>,Params)).
  +
  +query_announce_peer_0_test() ->
  +    Enc = "d1:ad2:id20:abcdefghij01234567899:info_hash20:"
  +        ++"mnopqrstuvwxyz1234564:porti6881e5:token8:aoeusnthe1:"
  +        ++"q13:announce_peer1:t2:aa1:y1:qe",
  +    Res = decode_msg(Enc),
  +    {announce, ID, Params} = Res,
  +    ?assertEqual(<<"aa">>, ID),
  +    ?assertEqual(<<"abcdefghij0123456789">>, fetch_id(Params)),
  +    ?assertEqual(<<"mnopqrstuvwxyz123456">>, get_value(<<"info_hash">>,Params)),
  +    ?assertEqual(<<"aoeusnth">>, get_value(<<"token">>, Params)),
  +    ?assertEqual(6881, get_value(<<"port">>, Params)).
  +
  +resp_ping_0_test() ->
  +    Enc = "d1:rd2:id20:mnopqrstuvwxyz123456e1:t2:aa1:y1:re",
  +    Res = decode_msg(Enc),
  +    {response, MsgID, Values} = Res,
  +    ID = decode_response(ping, Values),
  +    ?assertEqual(<<"aa">>, MsgID),
  +    ?assertEqual(etorrent_dht:integer_id(<<"mnopqrstuvwxyz123456">>), ID).
  +
  +resp_find_node_0_test() ->
  +    Enc = "d1:rd2:id20:0123456789abcdefghij5:nodes0:e1:t2:aa1:y1:re",
  +    {response, _, Values} = decode_msg(Enc),
  +    {ID, Nodes} = decode_response(find_node, Values),
  +    ?assertEqual(etorrent_dht:integer_id(<<"0123456789abcdefghij">>), ID),
  +    ?assertEqual([], Nodes).
  +
  +resp_find_node_1_test() ->
  +    Enc = "d1:rd2:id20:0123456789abcdefghij5:nodes26:"
  +         ++ "0123456789abcdefghij" ++ [0,0,0,0,0,0] ++ "e1:t2:aa1:y1:re",
  +    Res = decode_msg(Enc),
  +    {response, _, Values} = Res,
  +    {_, Nodes} = decode_response(find_node, Values),
  +    ?assertEqual([{etorrent_dht:integer_id("0123456789abcdefghij"),
  +                   {0,0,0,0}, 0}], Nodes).
  +
  +resp_get_peers_0_test() ->
  +    Enc = "d1:rd2:id20:abcdefghij01234567895:token8:aoeusnth6:values"
  +        ++ "l6:axje.u6:idhtnmee1:t2:aa1:y1:re",
  +    Res = decode_msg(Enc),
  +    {response, _, Values} = Res,
  +    {ID, Token, Peers, Nodes} = decode_response(get_peers, Values),
  +    ?assertEqual(etorrent_dht:integer_id(<<"abcdefghij0123456789">>), ID),
  +    ?assertEqual(<<"aoeusnth">>, Token),
  +    ?assertEqual([{{97,120,106,101},11893}, {{105,100,104,116}, 28269}], Peers).
  +
  +resp_get_peers_1_test() ->
  +    Enc = "d1:rd2:id20:abcdefghij01234567895:nodes26:"
  +        ++ "0123456789abcdefghijdef4565:token8:aoeusnthe"
  +        ++ "1:t2:aa1:y1:re",
  +    Res = decode_msg(Enc),
  +    {response, _, Values} = Res,
  +    {ID, Token, Peers, Nodes} = decode_response(get_peers, Values),
  +    ?assertEqual(etorrent_dht:integer_id(<<"abcdefghij0123456789">>), ID),
  +    ?assertEqual(<<"aoeusnth">>, Token),
  +    ?assertEqual([{etorrent_dht:integer_id(<<"0123456789abcdefghij">>),
  +                   {100,101,102,52},13622}], Nodes).
  +
  +resp_announce_peer_0_test() ->
  +    Enc = "d1:rd2:id20:mnopqrstuvwxyz123456e1:t2:aa1:y1:re",
  +    Res = decode_msg(Enc),
  +    {response, _, Values} = Res,
  +    ID = decode_response(announce, Values),
  +    ?assertEqual(etorrent_dht:integer_id(<<"mnopqrstuvwxyz123456">>), ID).
   
   -ifdef(EQC).
  -
  -
  -properties_test() ->
  -    ?assert(eqc:quickcheck(prop_inv_compact())).
  -
   
   octet() ->
      choose(0, 255).
  
positive.code:         timeout ->
              {error, timeout};
          Values  ->
              LID = get_string("id", Values),
              ID = etorrent_dht:integer_id(LID),
              LCompact = get_string("nodes", Values),
              Nodes = compact_to_node_infos(list_to_binary(LCompact)),
              etorrent_dht_state:log_request_success(ID, IP, Port),
              {ID, Nodes}
      end.
  
  
  
negative.code:     Announce = {announce, IP, Port, InfoHash, Token, BTPort},
      case gen_server:call(srv_name(), Announce) of
          timeout -> {error, timeout};
          Values ->
              decode_response(announce, Values)
      end.
  
  %
  