diff --git a/src/delegation-list.cpp b/src/delegation-list.cpp
index a0dd7c8..7868943 100644
--- a/src/delegation-list.cpp
+++ b/src/delegation-list.cpp
@@ -42,6 +42,14 @@
 {
 }
 
+DelegationList::DelegationList(std::initializer_list<Delegation> dels)
+  : m_isSorted(true)
+{
+  for (const Delegation& del : dels) {
+    this->insert(del, INS_REPLACE);
+  }
+}
+
 DelegationList::DelegationList(const Block& block, bool wantSort)
 {
   this->wireDecode(block, wantSort);
diff --git a/src/delegation-list.hpp b/src/delegation-list.hpp
index 9f74399..9ef5d97 100644
--- a/src/delegation-list.hpp
+++ b/src/delegation-list.hpp
@@ -23,6 +23,7 @@
 #define NDN_DELEGATION_LIST_HPP
 
 #include "delegation.hpp"
+#include <initializer_list>
 
 namespace ndn {
 
@@ -48,6 +49,13 @@
    */
   DelegationList();
 
+  /** \brief construct a sorted DelegationList with specified delegations
+   *
+   *  This is equivalent to inserting each delegation into an empty DelegationList with INS_REPLACE
+   *  conflict resolution.
+   */
+  DelegationList(std::initializer_list<Delegation> dels);
+
   /** \brief decode a DelegationList
    *  \sa wireDecode
    */
diff --git a/src/link.cpp b/src/link.cpp
index ebdb245..21e6045 100644
--- a/src/link.cpp
+++ b/src/link.cpp
@@ -20,12 +20,6 @@
  */
 
 #include "link.hpp"
-#include "interest.hpp"
-#include "encoding/block-helpers.hpp"
-#include "util/crypto.hpp"
-#include "security/key-chain.hpp"
-
-#include <boost/range/adaptor/reversed.hpp>
 
 namespace ndn {
 
@@ -36,209 +30,125 @@
 static_assert(std::is_base_of<Data::Error, Link::Error>::value,
               "Link::Error should inherit from Data::Error");
 
-Link::Link(const Block& block)
+Link::Link() = default;
+
+Link::Link(const Block& wire, bool wantSort)
 {
-  wireDecode(block);
+  this->wireDecode(wire, wantSort);
 }
 
-Link::Link(const Name& name)
+Link::Link(const Name& name, std::initializer_list<Delegation> dels)
   : Data(name)
+  , m_delList(dels)
 {
+  encodeContent();
 }
 
-Link::Link(const Name& name, std::initializer_list<std::pair<uint32_t, Name>> links)
-  : Data(name)
+void
+Link::encodeContent()
 {
-  m_delegations.insert(links);
+  setContentType(tlv::ContentType_Link);
+
+  if (m_delList.size() > 0) {
+    EncodingEstimator estimator;
+    size_t estimatedSize = m_delList.wireEncode(estimator, tlv::Content);
+
+    EncodingBuffer buffer(estimatedSize, 0);
+    m_delList.wireEncode(buffer, tlv::Content);
+
+    setContent(buffer.block());
+  }
+  else {
+    setContent(nullptr, 0);
+  }
+
+  m_isDelSetDirty = true;
+}
+
+void
+Link::wireDecode(const Block& wire, bool wantSort)
+{
+  Data::wireDecode(wire);
+
+  if (getContentType() != tlv::ContentType_Link) {
+    BOOST_THROW_EXCEPTION(Error("Expected ContentType Link"));
+  }
+
+  m_delList.wireDecode(getContent(), wantSort);
+  m_isDelSetDirty = true;
+}
+
+void
+Link::setDelegationList(const DelegationList& dels)
+{
+  m_delList = dels;
   encodeContent();
 }
 
 void
 Link::addDelegation(uint32_t preference, const Name& name)
 {
-  this->removeDelegationNoEncode(name);
-  m_delegations.insert({preference, name});
+  m_delList.insert(preference, name, DelegationList::INS_REPLACE);
   encodeContent();
 }
 
 bool
 Link::removeDelegation(const Name& name)
 {
-  bool hasRemovedDelegation = this->removeDelegationNoEncode(name);
-  if (hasRemovedDelegation) {
+  size_t nErased = m_delList.erase(name);
+  if (nErased > 0) {
     encodeContent();
   }
-  return hasRemovedDelegation;
+  return nErased > 0;
+}
+
+Link::PairInitializerListHelper::PairInitializerListHelper(std::initializer_list<std::pair<uint32_t, Name>> dels)
+{
+  for (const auto& p : dels) {
+    m_delList.insert(p.first, p.second, DelegationList::INS_REPLACE);
+  }
+}
+
+Link::Link(const Name& name, PairInitializerListHelper dels)
+  : Data(name)
+  , m_delList(std::move(dels.m_delList))
+{
+  encodeContent();
 }
 
 const Link::DelegationSet&
 Link::getDelegations() const
 {
-  return m_delegations;
-}
-
-template<encoding::Tag TAG>
-size_t
-Link::encodeContent(EncodingImpl<TAG>& encoder) const
-{
-  // LinkContent ::= CONTENT-TYPE TLV-LENGTH
-  //                    Delegation+
-
-  // Delegation ::= LINK-DELEGATION-TYPE TLV-LENGTH
-  //              Preference
-  //              Name
-
-  // Preference ::= LINK-PREFERENCE-TYPE TLV-LENGTH
-  //       nonNegativeInteger
-
-  size_t totalLength = 0;
-  for (const auto& delegation : m_delegations |  boost::adaptors::reversed) {
-    size_t delegationLength = 0;
-    delegationLength += std::get<1>(delegation).wireEncode(encoder);
-    delegationLength += prependNonNegativeIntegerBlock(encoder, tlv::LinkPreference,
-                                                       std::get<0>(delegation));
-    delegationLength += encoder.prependVarNumber(delegationLength);
-    delegationLength += encoder.prependVarNumber(tlv::LinkDelegation);
-    totalLength += delegationLength;
+  if (m_isDelSetDirty) {
+    m_delSet.clear();
+    for (const auto& del : m_delList) {
+      m_delSet.emplace(static_cast<uint32_t>(del.preference), del.name);
+    }
+    m_isDelSetDirty = false;
   }
-  totalLength += encoder.prependVarNumber(totalLength);
-  totalLength += encoder.prependVarNumber(tlv::Content);
-  return totalLength;
+  return m_delSet;
 }
 
-template size_t
-Link::encodeContent<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
-
-template size_t
-Link::encodeContent<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
-
-void
-Link::encodeContent()
-{
-  onChanged();
-
-  EncodingEstimator estimator;
-  size_t estimatedSize = encodeContent(estimator);
-
-  EncodingBuffer buffer(estimatedSize, 0);
-  encodeContent(buffer);
-
-  setContentType(tlv::ContentType_Link);
-  setContent(buffer.block());
-}
-
-void
-Link::decodeContent()
-{
-  // LinkContent ::= CONTENT-TYPE TLV-LENGTH
-  //                    Delegation+
-
-  // Delegation ::= LINK-DELEGATION-TYPE TLV-LENGTH
-  //              Preference
-  //              Name
-
-  // Preference ::= LINK-PREFERENCE-TYPE TLV-LENGTH
-  //       nonNegativeInteger
-
-  if (getContentType() != tlv::ContentType_Link)
-    {
-      BOOST_THROW_EXCEPTION(Error("Expected Content Type Link"));
-    }
-
-  const Block& content = getContent();
-  content.parse();
-
-  for (auto& delegation : content.elements()) {
-    delegation.parse();
-    Block::element_const_iterator val = delegation.elements_begin();
-    if (val == delegation.elements_end()) {
-      BOOST_THROW_EXCEPTION(Error("Unexpected Link Encoding"));
-    }
-    uint32_t preference;
-    try {
-      preference = static_cast<uint32_t>(readNonNegativeInteger(*val));
-    }
-    catch (const tlv::Error&) {
-      BOOST_THROW_EXCEPTION(Error("Missing Preference field in Link Encoding"));
-    }
-    ++val;
-    if (val == delegation.elements_end()) {
-      BOOST_THROW_EXCEPTION(Error("Missing Name field in Link Encoding"));
-    }
-    Name name(*val);
-    m_delegations.insert({preference, name});
-  }
-}
-
-void
-Link::wireDecode(const Block& wire)
-{
-  Data::wireDecode(wire);
-  decodeContent();
-}
-
-std::tuple<uint32_t, Name>
+Link::DelegationTuple
 Link::getDelegationFromWire(const Block& block, size_t index)
 {
-  block.parse();
-  const Block& contentBlock = block.get(tlv::Content);
-  contentBlock.parse();
-  const Block& delegationBlock = contentBlock.elements().at(index);
-  delegationBlock.parse();
-  if (delegationBlock.type() != tlv::LinkDelegation) {
-    BOOST_THROW_EXCEPTION(Error("Unexpected TLV-TYPE, expecting LinkDelegation"));
-  }
-  return std::make_tuple(
-    static_cast<uint32_t>(
-      readNonNegativeInteger(delegationBlock.get(tlv::LinkPreference))),
-    Name(delegationBlock.get(tlv::Name)));
+  Delegation del = Link(block, false).getDelegationList().at(index);
+  return std::make_tuple(static_cast<uint32_t>(del.preference), del.name);
 }
 
 ssize_t
 Link::findDelegationFromWire(const Block& block, const Name& delegationName)
 {
-  block.parse();
-  const Block& contentBlock = block.get(tlv::Content);
-  contentBlock.parse();
-  size_t counter = 0;
-  for (auto&& delegationBlock : contentBlock.elements()) {
-    delegationBlock.parse();
-    if (delegationBlock.type() != tlv::LinkDelegation) {
-      BOOST_THROW_EXCEPTION(Error("Unexpected TLV-TYPE, expecting LinkDelegation"));
-    }
-    Name name(delegationBlock.get(tlv::Name));
-    if (name == delegationName) {
-      return counter;
-    }
-    ++counter;
-  }
-  return INVALID_SELECTED_DELEGATION_INDEX;
+  DelegationList dels = Link(block, false).getDelegationList();
+  auto i = std::find_if(dels.begin(), dels.end(),
+           [delegationName] (const Delegation& del) { return del.name == delegationName; });
+  return i == dels.end() ? -1 : std::distance(dels.begin(), i);
 }
 
 ssize_t
 Link::countDelegationsFromWire(const Block& block)
 {
-  block.parse();
-  const Block& contentBlock = block.get(tlv::Content);
-  contentBlock.parse();
-  return contentBlock.elements_size();
-}
-
-bool
-Link::removeDelegationNoEncode(const Name& name)
-{
-  bool hasRemoved = false;
-  auto i = m_delegations.begin();
-  while (i != m_delegations.end()) {
-    if (i->second == name) {
-      hasRemoved = true;
-      i = m_delegations.erase(i);
-    }
-    else {
-      ++i;
-    }
-  }
-  return hasRemoved;
+  return Link(block, false).getDelegationList().size();
 }
 
 } // namespace ndn
diff --git a/src/link.hpp b/src/link.hpp
index 03b83a6..3fc4387 100644
--- a/src/link.hpp
+++ b/src/link.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -23,13 +23,14 @@
 #define NDN_LINK_HPP
 
 #include "data.hpp"
+#include "delegation-list.hpp"
 #include <set>
 
 namespace ndn {
 
 const size_t INVALID_SELECTED_DELEGATION_INDEX = std::numeric_limits<size_t>::max();
 
-/** @brief represents a Link instance
+/** @brief represents a Link object
  */
 class Link : public Data
 {
@@ -44,139 +45,142 @@
     }
   };
 
-  // The ordering is based on the preference number and needs to be preserved
-  typedef std::set<std::pair<uint32_t, Name>> DelegationSet;
-
-  /**
-   * @brief Create an empty Link object
+  /** @brief Create an empty Link object
    *
-   * Note that in certain contexts that use Link::shared_from_this(), Link must be
-   * created using `make_shared`:
+   *  Note that in certain contexts that use Link::shared_from_this(), Link must be
+   *  created using `make_shared`:
    *
-   *     shared_ptr<Link> linkObject = make_shared<Link>();
-   *
-   * Otherwise, Link::shared_from_this() will throw std::bad_weak_ptr.
+   *      shared_ptr<Link> linkObject = make_shared<Link>();
    */
-  Link() = default;
+  Link();
 
-  /**
-   * @brief Create a Link object from a Block
+  /** @brief Decode a Link object from a Block
+   *  @param wire a TLV block
+   *  @param wantSort if false, relative order among delegations is preserved
    *
-   * Note that in certain contexts that use Link::shared_from_this(), Link must be
-   * created using `make_shared`:
+   *  Note that in certain contexts that use Link::shared_from_this(), Link must be
+   *  created using `make_shared`:
    *
-   *     shared_ptr<Link> linkObject = make_shared<Link>(block);
-   *
-   * Otherwise, Link::shared_from_this() will throw std::bad_weak_ptr.
+   *      shared_ptr<Link> linkObject = make_shared<Link>(block);
    */
   explicit
-  Link(const Block& block);
+  Link(const Block& wire, bool wantSort = true);
 
-  /**
-   * @brief Create a Link object with the given name
+  /** @brief Create a Link object with the given name and delegations
+   *  @param name A reference to the name of the redirected namespace
+   *  @param dels Delegations in payload
    *
-   * @param name A reference to the name of the redirected namespace
+   *  Note that in certain contexts that use Link::shared_from_this(), Link must be
+   *  created using `make_shared`:
    *
-   * Note that in certain contexts that use Link::shared_from_this(), Link must be
-   * created using `make_shared`:
-   *
-   *     shared_ptr<Link> link = make_shared<Link>(name);
-   *
-   * Otherwise, Link::shared_from_this() will throw std::bad_weak_ptr.
+   *      shared_ptr<Link> link = make_shared<Link>(name, dels);
    */
   explicit
-  Link(const Name& name);
+  Link(const Name& name, std::initializer_list<Delegation> dels = {});
 
- /**
-   * @brief Create a Link object with the given name and pairs of <Preference, Name>
-   *
-   * @param name A reference to the name of the redirected namespace
-   * @param links A reference to the list of pairs of the redirected namespace
-   * along with its priority
-   *
-   * Note that in certain contexts that use Link::shared_from_this(), Link must be
-   * created using `make_shared`:
-   *
-   *     shared_ptr<Link> link = make_shared<Link>(name, links);
-   *
-   * Otherwise, Link::shared_from_this() will throw std::bad_weak_ptr.
+  /** @brief Decode from the wire format
+   *  @param wire a TLV block
+   *  @param wantSort if false, relative order among delegations is preserved
    */
-  Link(const Name& name, std::initializer_list<std::pair<uint32_t, Name>> links);
+  void
+  wireDecode(const Block& wire, bool wantSort = true);
 
-  /**
-   * @brief Add a delegation in the format of <Name, Preference>
-   * @param preference The preference of the delegation to be added
-   * @param name The name of the delegation to be added
-   * @note If a delegation with @p name exists, its preference will be updated
+  /** @brief Get the delegations
+   */
+  const DelegationList&
+  getDelegationList() const
+  {
+    return m_delList;
+  }
+
+  /** @brief Set the delegations
+   *  @note This is more efficient than multiple addDelegation and removeDelegation invocations.
+   */
+  void
+  setDelegationList(const DelegationList& dels);
+
+  /** @brief Add a delegation in the format of <Name, Preference>
+   *  @param preference The preference of the delegation to be added
+   *  @param name The name of the delegation to be added
+   *  @note If a delegation with @p name exists, its preference will be updated
    */
   void
   addDelegation(uint32_t preference, const Name& name);
 
-  /**
-   * @brief Remove a delegation whose name is @p name
-   * @param name The name of the delegation to be removed
-   * @return true if delegation is removed, otherwise false
+  /** @brief Remove a delegation whose name is @p name
+   *  @param name The name of the delegation to be removed
+   *  @return true if delegation is removed, otherwise false
    */
   bool
   removeDelegation(const Name& name);
 
-  /**
-   * @brief Get the pairs of <Name, Preference>
-   * @return a set of delegations
-   */
-  const DelegationSet&
-  getDelegations() const;
+public: // deprecated APIs
+  using DelegationSet = std::set<std::pair<uint32_t, Name>>;
+  using DelegationTuple = std::tuple<uint32_t, Name>;
 
-  /**
-   * @brief Decode from the wire format
-   * @warning This method does not preserve the relative order between delegations.
-   *     To get a delegation by index, use @p getDelegationFromWire method.
+  class PairInitializerListHelper
+  {
+  public:
+    PairInitializerListHelper(std::initializer_list<std::pair<uint32_t, Name>> dels);
+
+  private:
+    DelegationList m_delList;
+    friend class Link;
+  };
+
+  /** @brief Create a Link object with the given name and delegations
+   *  @param name A reference to the name of the redirected namespace
+   *  @param dels Delegations in payload
+   *  @deprecated use Link(const Name&, std::initializer_list<Delegation>)
+   *  @note This overload is selected only if the caller explicitly passes
+   *        std::initializer_list<std::pair<uint32_t, Name>> to Link constructor;
+   *        otherwise, Link(const Name&, std::initializer_list<Delegation>) is preferred.
    */
-  void
-  wireDecode(const Block& wire);
+  DEPRECATED(
+  Link(const Name& name, PairInitializerListHelper dels));
+
+  /** @deprecated use getDelegationList()
+   */
+  DEPRECATED(
+  const DelegationSet&
+  getDelegations() const);
 
   /** @brief gets the delegation at @p index from @p block
    *  @param block wire format of a Link object
    *  @param index 0-based index of a delegation in the Link object
    *  @return delegation preference and name
    *  @throw std::out_of_range index is out of range
+   *  @deprecated use Link(block, false).getDelegationList().at(index)
    */
-  static std::tuple<uint32_t, Name>
-  getDelegationFromWire(const Block& block, size_t index);
+  DEPRECATED(
+  static DelegationTuple
+  getDelegationFromWire(const Block& block, size_t index));
 
   /** @brief finds index of a delegation with @p delegationName from @p block
    *  @param block wire format of a Link object
    *  @param delegationName delegation name in the Link object
    *  @return 0-based index of the first delegation with @p delegationName ,
    *          or -1 if no such delegation exists
+   *  @deprecated find within Link(block, false).getDelegationList()
    */
+  DEPRECATED(
   static ssize_t
-  findDelegationFromWire(const Block& block, const Name& delegationName);
+  findDelegationFromWire(const Block& block, const Name& delegationName));
 
-  static ssize_t
-  countDelegationsFromWire(const Block& block);
-
-protected:
-  /** @brief prepend Link object as a Content block to the encoder
-   *
-   *  The outermost Content element is not part of Link object structure.
+  /** @deprecated use Link(block, false).getDelegationList().size()
    */
-  template<encoding::Tag TAG>
-  size_t
-  encodeContent(EncodingImpl<TAG>& encoder) const;
+  DEPRECATED(
+  static ssize_t
+  countDelegationsFromWire(const Block& block));
 
+private:
   void
   encodeContent();
 
-  void
-  decodeContent();
-
 private:
-  bool
-  removeDelegationNoEncode(const Name& name);
-
-private:
-  DelegationSet m_delegations;
+  DelegationList m_delList;
+  mutable bool m_isDelSetDirty = false;
+  mutable DelegationSet m_delSet;
 };
 
 } // namespace ndn
diff --git a/tests/unit-tests/delegation-list.t.cpp b/tests/unit-tests/delegation-list.t.cpp
index 5961af5..b98c67a 100644
--- a/tests/unit-tests/delegation-list.t.cpp
+++ b/tests/unit-tests/delegation-list.t.cpp
@@ -181,8 +181,7 @@
 
 BOOST_AUTO_TEST_CASE(InsertReplace)
 {
-  DelegationList dl;
-  dl.insert(2, "/A");
+  DelegationList dl({{2, "/A"}});
   dl.insert(Delegation{1, "/A"}, DelegationList::INS_REPLACE);
   BOOST_CHECK_EQUAL(dl.size(), 1);
   BOOST_CHECK_EQUAL(dl.at(0).preference, 1);
@@ -195,8 +194,7 @@
 
 BOOST_AUTO_TEST_CASE(InsertAppend)
 {
-  DelegationList dl;
-  dl.insert(2, "/A");
+  DelegationList dl({{2, "/A"}});
   dl.insert(Delegation{1, "/A"}, DelegationList::INS_APPEND);
   BOOST_CHECK_EQUAL(dl.size(), 2);
   BOOST_CHECK_EQUAL(dl.at(0).preference, 1);
@@ -209,8 +207,7 @@
 
 BOOST_AUTO_TEST_CASE(InsertSkip)
 {
-  DelegationList dl;
-  dl.insert(2, "/A");
+  DelegationList dl({{2, "/A"}});
   dl.insert(Delegation{1, "/A"}, DelegationList::INS_SKIP);
   BOOST_CHECK_EQUAL(dl.size(), 1);
   BOOST_CHECK_EQUAL(dl.at(0).preference, 2);
diff --git a/tests/unit-tests/interest.t.cpp b/tests/unit-tests/interest.t.cpp
index 3e31438..295af50 100644
--- a/tests/unit-tests/interest.t.cpp
+++ b/tests/unit-tests/interest.t.cpp
@@ -221,7 +221,7 @@
 };
 
 const uint8_t InterestWithLinkMissingContentType[] = {
-  0x05,  0xf8, // Interest
+  0x05,  0xf5, // Interest
       0x07,  0x14, // Name
           0x08,  0x5, // NameComponent
               0x6c,  0x6f,  0x63,  0x61,  0x6c,
@@ -276,13 +276,11 @@
                0x64, 0xd6, 0x66, 0xb4, 0xe9, 0x8d, 0x0c, 0x28, 0x43, 0xee, 0xa6, 0x64, 0xe8,
                0x55, 0xf6, 0x1c, 0x19, 0x0b, 0xef, 0x99, 0x25, 0x1e, 0xdc, 0x78, 0xb3, 0xa7,
                0xaa, 0x0d, 0x14, 0x58, 0x30, 0xe5, 0x37, 0x6a, 0x6d, 0xdb, 0x56, 0xac, 0xa3,
-               0xfc, 0x90, 0x7a, 0xb8, 0x66, 0x9c, 0x0e, 0xf6, 0xb7, 0x64, 0xd1,
-      0x20, 0x01, // SelectedDelegation
-          0x00
+               0xfc, 0x90, 0x7a, 0xb8, 0x66, 0x9c, 0x0e, 0xf6, 0xb7, 0x64, 0xd1
 };
 
 const uint8_t InterestWithLinkNoMetaInfo[] = {
-  0x05,  0xf2, // Interest
+  0x05,  0xef, // Interest
       0x07,  0x14, // Name
           0x08,  0x5, // NameComponent
               0x6c,  0x6f,  0x63,  0x61,  0x6c,
@@ -334,13 +332,11 @@
                0x64, 0xd6, 0x66, 0xb4, 0xe9, 0x8d, 0x0c, 0x28, 0x43, 0xee, 0xa6, 0x64, 0xe8,
                0x55, 0xf6, 0x1c, 0x19, 0x0b, 0xef, 0x99, 0x25, 0x1e, 0xdc, 0x78, 0xb3, 0xa7,
                0xaa, 0x0d, 0x14, 0x58, 0x30, 0xe5, 0x37, 0x6a, 0x6d, 0xdb, 0x56, 0xac, 0xa3,
-               0xfc, 0x90, 0x7a, 0xb8, 0x66, 0x9c, 0x0e, 0xf6, 0xb7, 0x64, 0xd1,
-      0x20, 0x01, // SelectedDelegation
-          0x00
+               0xfc, 0x90, 0x7a, 0xb8, 0x66, 0x9c, 0x0e, 0xf6, 0xb7, 0x64, 0xd1
 };
 
 const uint8_t InterestWithLinkWrongContentType[] = {
-  0x05,  0xfb, // Interest
+  0x05,  0xf8, // Interest
       0x07,  0x14, // Name
           0x08,  0x5, // NameComponent
               0x6c,  0x6f,  0x63,  0x61,  0x6c,
@@ -397,9 +393,7 @@
                0x64, 0xd6, 0x66, 0xb4, 0xe9, 0x8d, 0x0c, 0x28, 0x43, 0xee, 0xa6, 0x64, 0xe8,
                0x55, 0xf6, 0x1c, 0x19, 0x0b, 0xef, 0x99, 0x25, 0x1e, 0xdc, 0x78, 0xb3, 0xa7,
                0xaa, 0x0d, 0x14, 0x58, 0x30, 0xe5, 0x37, 0x6a, 0x6d, 0xdb, 0x56, 0xac, 0xa3,
-               0xfc, 0x90, 0x7a, 0xb8, 0x66, 0x9c, 0x0e, 0xf6, 0xb7, 0x64, 0xd1,
-      0x20, 0x01, // SelectedDelegation
-          0x00
+               0xfc, 0x90, 0x7a, 0xb8, 0x66, 0x9c, 0x0e, 0xf6, 0xb7, 0x64, 0xd1
 };
 
 const uint8_t InterestWithSelectedDelegationButNoLink[] = {
@@ -932,9 +926,7 @@
   Block interestBlock(InterestWithLinkMissingContentType,
                       sizeof(InterestWithLinkMissingContentType));
 
-  ndn::Interest i;
-  BOOST_REQUIRE_NO_THROW(i.wireDecode(interestBlock));
-  BOOST_REQUIRE_THROW(i.getLink(), Link::Error);
+  BOOST_CHECK_THROW(Interest(interestBlock).getLink(), tlv::Error);
 }
 
 BOOST_AUTO_TEST_CASE(LinkObjectNoMetaInfo)
@@ -942,10 +934,7 @@
   Block interestBlock(InterestWithLinkNoMetaInfo,
                       sizeof(InterestWithLinkNoMetaInfo));
 
-  ndn::Interest i;
-  BOOST_REQUIRE_NO_THROW(i.wireDecode(interestBlock));
-  BOOST_CHECK_THROW(i.getLink(), tlv::Error);
-  BOOST_CHECK_THROW(i.getLink(), tlv::Error);
+  BOOST_CHECK_THROW(Interest(interestBlock).getLink(), tlv::Error);
 }
 
 BOOST_AUTO_TEST_CASE(LinkObjectWrongContentType)
@@ -953,9 +942,7 @@
   Block interestBlock(InterestWithLinkWrongContentType,
                       sizeof(InterestWithLinkWrongContentType));
 
-  ndn::Interest i;
-  BOOST_REQUIRE_NO_THROW(i.wireDecode(interestBlock));
-  BOOST_CHECK_THROW(i.getLink(), Link::Error);
+  BOOST_CHECK_THROW(Interest(interestBlock).getLink(), tlv::Error);
 }
 
 BOOST_AUTO_TEST_CASE(InterestContainingSelectedDelegationButNoLink)
diff --git a/tests/unit-tests/link.t.cpp b/tests/unit-tests/link.t.cpp
index 6e29a5e..a12793a 100644
--- a/tests/unit-tests/link.t.cpp
+++ b/tests/unit-tests/link.t.cpp
@@ -24,14 +24,14 @@
 #include "encoding/buffer-stream.hpp"
 
 #include "boost-test.hpp"
-#include "identity-management-fixture.hpp"
+#include "make-interest-data.hpp"
 
 namespace ndn {
 namespace tests {
 
 BOOST_AUTO_TEST_SUITE(TestLink)
 
-const uint8_t LinkTest[] = {
+const uint8_t GOOD_LINK[] = {
 0x06, 0xda, // Data
     0x07, 0x14, // Name
         0x08, 0x05,
@@ -82,322 +82,137 @@
         0xfc, 0x90, 0x7a, 0xb8, 0x66, 0x9c, 0x0e, 0xf6, 0xb7, 0x64, 0xd1
 };
 
-const uint8_t IncorrectContentTypeLink[] = {
-0x06, 0xda, // Data
-    0x07, 0x14, // Name
-        0x08, 0x05,
-            0x6c, 0x6f, 0x63, 0x61, 0x6c,
-        0x08, 0x03,
-            0x6e, 0x64, 0x6e,
-        0x08, 0x06,
-            0x70, 0x72, 0x65, 0x66, 0x69, 0x78,
-    0x14, 0x07, // MetaInfo
-        0x18, 0x01, // ContentType
-            0x02,
-        0x19, 0x02, // FreshnessPeriod
-            0x27, 0x10,
-    0x15, 0x1a, // Content
-        0x1f, 0x0c,  // LinkDelegation
-            0x1e, 0x01, // LinkPreference
-                0x0a,
-            0x07, 0x07, // Name
-                0x08, 0x05,
-                    0x6c, 0x6f, 0x63, 0x61, 0x6c,
-        0x1f, 0x0a, // LinkDelegation
-            0x1e, 0x01, // LinkPreference
-                0x14,
-            0x07, 0x05, // Name
-                0x08, 0x03,
-                    0x6e, 0x64, 0x6e,
-    0x16, 0x1b, // SignatureInfo
-        0x1b, 0x01, // SignatureType
-            0x01,
-        0x1c, 0x16, // KeyLocator
-            0x07, 0x14, // Name
-                0x08, 0x04,
-                    0x74, 0x65, 0x73, 0x74,
-                0x08, 0x03,
-                    0x6b, 0x65, 0x79,
-                0x08, 0x07,
-                    0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72,
-    0x17, 0x80, // SignatureValue
-        0x2f, 0xd6, 0xf1, 0x6e, 0x80, 0x6f, 0x10, 0xbe, 0xb1, 0x6f, 0x3e, 0x31, 0xec,
-        0xe3, 0xb9, 0xea, 0x83, 0x30, 0x40, 0x03, 0xfc, 0xa0, 0x13, 0xd9, 0xb3, 0xc6,
-        0x25, 0x16, 0x2d, 0xa6, 0x58, 0x41, 0x69, 0x62, 0x56, 0xd8, 0xb3, 0x6a, 0x38,
-        0x76, 0x56, 0xea, 0x61, 0xb2, 0x32, 0x70, 0x1c, 0xb6, 0x4d, 0x10, 0x1d, 0xdc,
-        0x92, 0x8e, 0x52, 0xa5, 0x8a, 0x1d, 0xd9, 0x96, 0x5e, 0xc0, 0x62, 0x0b, 0xcf,
-        0x3a, 0x9d, 0x7f, 0xca, 0xbe, 0xa1, 0x41, 0x71, 0x85, 0x7a, 0x8b, 0x5d, 0xa9,
-        0x64, 0xd6, 0x66, 0xb4, 0xe9, 0x8d, 0x0c, 0x28, 0x43, 0xee, 0xa6, 0x64, 0xe8,
-        0x55, 0xf6, 0x1c, 0x19, 0x0b, 0xef, 0x99, 0x25, 0x1e, 0xdc, 0x78, 0xb3, 0xa7,
-        0xaa, 0x0d, 0x14, 0x58, 0x30, 0xe5, 0x37, 0x6a, 0x6d, 0xdb, 0x56, 0xac, 0xa3,
-        0xfc, 0x90, 0x7a, 0xb8, 0x66, 0x9c, 0x0e, 0xf6, 0xb7, 0x64, 0xd1
-};
-
-const uint8_t MissingPreferenceLink[] = {
-0x06, 0xd7, // Data
-    0x07, 0x14, // Name
-        0x08, 0x05,
-            0x6c, 0x6f, 0x63, 0x61, 0x6c,
-        0x08, 0x03,
-            0x6e, 0x64, 0x6e,
-        0x08, 0x06,
-            0x70, 0x72, 0x65, 0x66, 0x69, 0x78,
-    0x14, 0x07, // MetaInfo
-        0x18, 0x01, // ContentType
-            0x01,
-        0x19, 0x02, // FreshnessPeriod
-            0x27, 0x10,
-    0x15, 0x17, // Content
-        0x1f, 0x09, // LinkDelegation
-            0x07, 0x07, // Name
-                0x08, 0x05,
-                    0x6c, 0x6f, 0x63, 0x61, 0x6c,
-        0x1f, 0x0a, // LinkDelegation
-            0x1e, 0x01, // LinkPreference
-                0x14,
-            0x07, 0x05, // Name
-                0x08, 0x03,
-                    0x6e, 0x64, 0x6e,
-    0x16, 0x1b, // SignatureInfo
-        0x1b, 0x01, // SignatureType
-            0x01,
-        0x1c, 0x16, // KeyLocator
-            0x07, 0x14, // Name
-                0x08, 0x04,
-                    0x74, 0x65, 0x73, 0x74,
-                0x08, 0x03,
-                    0x6b, 0x65, 0x79,
-                0x08, 0x07,
-                    0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72,
-    0x17, 0x80, // SignatureValue
-        0x2f, 0xd6, 0xf1, 0x6e, 0x80, 0x6f, 0x10, 0xbe, 0xb1, 0x6f, 0x3e, 0x31, 0xec,
-        0xe3, 0xb9, 0xea, 0x83, 0x30, 0x40, 0x03, 0xfc, 0xa0, 0x13, 0xd9, 0xb3, 0xc6,
-        0x25, 0x16, 0x2d, 0xa6, 0x58, 0x41, 0x69, 0x62, 0x56, 0xd8, 0xb3, 0x6a, 0x38,
-        0x76, 0x56, 0xea, 0x61, 0xb2, 0x32, 0x70, 0x1c, 0xb6, 0x4d, 0x10, 0x1d, 0xdc,
-        0x92, 0x8e, 0x52, 0xa5, 0x8a, 0x1d, 0xd9, 0x96, 0x5e, 0xc0, 0x62, 0x0b, 0xcf,
-        0x3a, 0x9d, 0x7f, 0xca, 0xbe, 0xa1, 0x41, 0x71, 0x85, 0x7a, 0x8b, 0x5d, 0xa9,
-        0x64, 0xd6, 0x66, 0xb4, 0xe9, 0x8d, 0x0c, 0x28, 0x43, 0xee, 0xa6, 0x64, 0xe8,
-        0x55, 0xf6, 0x1c, 0x19, 0x0b, 0xef, 0x99, 0x25, 0x1e, 0xdc, 0x78, 0xb3, 0xa7,
-        0xaa, 0x0d, 0x14, 0x58, 0x30, 0xe5, 0x37, 0x6a, 0x6d, 0xdb, 0x56, 0xac, 0xa3,
-        0xfc, 0x90, 0x7a, 0xb8, 0x66, 0x9c, 0x0e, 0xf6, 0xb7, 0x64, 0xd1
-};
-
-const uint8_t MissingNameLink[] = {
-0x06, 0xd1, // Data
-    0x07, 0x14, // Name
-        0x08, 0x05,
-            0x6c, 0x6f, 0x63, 0x61, 0x6c,
-        0x08, 0x03,
-            0x6e, 0x64, 0x6e,
-        0x08, 0x06,
-            0x70, 0x72, 0x65, 0x66, 0x69, 0x78,
-    0x14, 0x07, // MetaInfo
-        0x18, 0x01, // ContentType
-            0x01,
-        0x19, 0x02, // FreshnessPeriod
-            0x27, 0x10,
-    0x15, 0x11, // Content
-        0x1f, 0x03, // LinkDelegation
-            0x1e, 0x01, // LinkPreference
-                0x0a,
-        0x1f, 0x0a, // LinkDelegation
-            0x1e, 0x01, // LinkPreference
-                0x14,
-            0x07, 0x05, // Name
-                0x08, 0x03,
-                    0x6e, 0x64, 0x6e,
-    0x16, 0x1b, // SignatureInfo
-        0x1b, 0x01, // SignatureType
-            0x01,
-        0x1c, 0x16, // KeyLocator
-            0x07, 0x14, // Name
-                0x08, 0x04,
-                    0x74, 0x65, 0x73, 0x74,
-                0x08, 0x03,
-                    0x6b, 0x65, 0x79,
-                0x08, 0x07,
-                    0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72,
-    0x17, 0x80, // SignatureValue
-        0x2f, 0xd6, 0xf1, 0x6e, 0x80, 0x6f, 0x10, 0xbe, 0xb1, 0x6f, 0x3e, 0x31, 0xec,
-        0xe3, 0xb9, 0xea, 0x83, 0x30, 0x40, 0x03, 0xfc, 0xa0, 0x13, 0xd9, 0xb3, 0xc6,
-        0x25, 0x16, 0x2d, 0xa6, 0x58, 0x41, 0x69, 0x62, 0x56, 0xd8, 0xb3, 0x6a, 0x38,
-        0x76, 0x56, 0xea, 0x61, 0xb2, 0x32, 0x70, 0x1c, 0xb6, 0x4d, 0x10, 0x1d, 0xdc,
-        0x92, 0x8e, 0x52, 0xa5, 0x8a, 0x1d, 0xd9, 0x96, 0x5e, 0xc0, 0x62, 0x0b, 0xcf,
-        0x3a, 0x9d, 0x7f, 0xca, 0xbe, 0xa1, 0x41, 0x71, 0x85, 0x7a, 0x8b, 0x5d, 0xa9,
-        0x64, 0xd6, 0x66, 0xb4, 0xe9, 0x8d, 0x0c, 0x28, 0x43, 0xee, 0xa6, 0x64, 0xe8,
-        0x55, 0xf6, 0x1c, 0x19, 0x0b, 0xef, 0x99, 0x25, 0x1e, 0xdc, 0x78, 0xb3, 0xa7,
-        0xaa, 0x0d, 0x14, 0x58, 0x30, 0xe5, 0x37, 0x6a, 0x6d, 0xdb, 0x56, 0xac, 0xa3,
-        0xfc, 0x90, 0x7a, 0xb8, 0x66, 0x9c, 0x0e, 0xf6, 0xb7, 0x64, 0xd1
-};
-
-BOOST_AUTO_TEST_CASE(PairParsingCheck)
-{
-  Link link("test", {{10, "/test1"}, {20, "/test2"}, {100, "/test3"}});
-  BOOST_CHECK_EQUAL(link.getDelegations().size(), static_cast<uint32_t>(3));
-}
-
-BOOST_AUTO_TEST_CASE(CheckInsertDelegation)
-{
-  Link link("test", {{10, "/test1"}, {20, "/test2"}, {100, "/test3"}});
-
-  link.addDelegation(30, Name("test4"));
-  Link::DelegationSet delegations = link.getDelegations();
-  int counter = 0;
-  for (auto i = delegations.begin(); i != delegations.end(); i++) {
-    counter++;
-    if (counter == 1)
-      {
-        BOOST_CHECK_EQUAL(std::get<0>(*i), 10);
-        BOOST_CHECK_EQUAL(std::get<1>(*i), Name("test1"));
-      }
-    if (counter == 2)
-      {
-        BOOST_CHECK_EQUAL(std::get<0>(*i), 20);
-        BOOST_CHECK_EQUAL(std::get<1>(*i), Name("test2"));
-      }
-    if (counter == 3)
-      {
-        BOOST_CHECK_EQUAL(std::get<0>(*i), 30);
-        BOOST_CHECK_EQUAL(std::get<1>(*i), Name("test4"));
-      }
-    if (counter == 4)
-      {
-        BOOST_CHECK_EQUAL(std::get<0>(*i), 100);
-        BOOST_CHECK_EQUAL(std::get<1>(*i), Name("test3"));
-      }
-  }
-}
-
-BOOST_AUTO_TEST_CASE(CheckRemoveDelegation)
-{
-  Link link("test", {{10, "/test1"}, {20, "/test2"}, {100, "/test3"}});
-
-  link.removeDelegation(Name("test2"));
-  Link::DelegationSet delegations = link.getDelegations();
-  int counter = 0;
-  for (auto i = delegations.begin(); i != delegations.end(); i++) {
-    counter++;
-    if (counter == 1)
-      {
-        BOOST_CHECK_EQUAL(std::get<0>(*i), 10);
-        BOOST_CHECK_EQUAL(std::get<1>(*i), Name("test1"));
-      }
-    if (counter == 2)
-      {
-        BOOST_CHECK_EQUAL(std::get<0>(*i), 100);
-        BOOST_CHECK_EQUAL(std::get<1>(*i), Name("test3"));
-      }
-  }
-}
-
-BOOST_FIXTURE_TEST_CASE(CheckEncodeDecode, IdentityManagementFixture)
-{
-  Link link1("test", {{10, "/test1"}, {20, "/test2"}, {100, "/test3"}});
-  m_keyChain.sign(link1);
-  Block wire = link1.wireEncode();
-
-  Link link2;
-  link2.wireDecode(wire);
-  Name name = link2.getName();
-  BOOST_CHECK_EQUAL(Name("test"), name);
-
-  Link::DelegationSet delegations;
-  delegations = link2.getDelegations();
-  int counter = 0;
-  for (auto i = delegations.begin(); i != delegations.end(); i++) {
-    counter++;
-    if (counter == 1)
-      {
-        BOOST_CHECK_EQUAL(std::get<0>(*i), 10);
-        BOOST_CHECK_EQUAL(std::get<1>(*i), Name("test1"));
-      }
-    if (counter == 2)
-      {
-        BOOST_CHECK_EQUAL(std::get<0>(*i), 20);
-        BOOST_CHECK_EQUAL(std::get<1>(*i), Name("test2"));
-      }
-    if (counter == 3)
-      {
-        BOOST_CHECK_EQUAL(std::get<0>(*i), 100);
-        BOOST_CHECK_EQUAL(std::get<1>(*i), Name("test3"));
-      }
-  }
-
-  Link link3(wire);
-  name = link3.getName();
-  BOOST_CHECK_EQUAL(Name("test"), name);
-
-  delegations = link3.getDelegations();
-  counter = 0;
-  for (auto i = delegations.begin(); i != delegations.end(); i++) {
-    counter++;
-    if (counter == 1)
-      {
-        BOOST_CHECK_EQUAL(std::get<0>(*i), 10);
-        BOOST_CHECK_EQUAL(std::get<1>(*i), Name("test1"));
-      }
-    if (counter == 2)
-      {
-        BOOST_CHECK_EQUAL(std::get<0>(*i), 20);
-        BOOST_CHECK_EQUAL(std::get<1>(*i), Name("test2"));
-      }
-    if (counter == 3)
-      {
-        BOOST_CHECK_EQUAL(std::get<0>(*i), 100);
-        BOOST_CHECK_EQUAL(std::get<1>(*i), Name("test3"));
-      }
-  }
-}
+BOOST_AUTO_TEST_SUITE(EncodeDecode)
 
 BOOST_AUTO_TEST_CASE(Decode)
 {
-  Block linkBlock(LinkTest, sizeof(LinkTest));
-  Link link(linkBlock);
+  Link link(Block(GOOD_LINK, sizeof(GOOD_LINK)));
   BOOST_CHECK_EQUAL(link.getName(), Name("/local/ndn/prefix"));
-  Link::DelegationSet delegations = link.getDelegations();
-  int counter = 0;
-
-  for (auto i = delegations.begin(); i != delegations.end(); i++) {
-    counter++;
-    if (counter == 1)
-      {
-        BOOST_CHECK_EQUAL(std::get<0>(*i), 10);
-        BOOST_CHECK_EQUAL(std::get<1>(*i), Name("local"));
-      }
-    if (counter == 2)
-      {
-        BOOST_CHECK_EQUAL(std::get<0>(*i), 20);
-        BOOST_CHECK_EQUAL(std::get<1>(*i), Name("ndn"));
-      }
-  }
+  BOOST_CHECK_EQUAL(link.getDelegationList(),
+                    DelegationList({{10, Name("/local")}, {20, Name("/ndn")}}));
 }
 
-BOOST_AUTO_TEST_CASE(CountDelegationFromWire)
+BOOST_AUTO_TEST_CASE(DecodeBadContentType)
 {
-  Block linkBlock(LinkTest, sizeof(LinkTest));
+  Data linkData(Block(GOOD_LINK, sizeof(GOOD_LINK)));
+  linkData.setContentType(tlv::ContentType_Key);
+  Block badLink = linkData.wireEncode();
+
+  BOOST_CHECK_THROW((Link(badLink)), Link::Error);
+  Link link;
+  BOOST_CHECK_THROW(link.wireDecode(badLink), Link::Error);
+}
+
+BOOST_AUTO_TEST_CASE(Encode)
+{
+  Link link1("/test", {{10, "/test1"}, {20, "/test2"}, {100, "/test3"}});
+  signData(link1);
+  Block wire = link1.wireEncode();
+
+  Link link2(wire);
+  BOOST_CHECK_EQUAL(link2.getName(), "/test");
+  BOOST_CHECK_EQUAL(link2.getDelegationList(),
+                    DelegationList({{10, "/test1"}, {20, "/test2"}, {100, "/test3"}}));
+}
+
+BOOST_AUTO_TEST_SUITE_END() // EncodeDecode
+
+BOOST_AUTO_TEST_SUITE(Modify)
+
+BOOST_AUTO_TEST_CASE(SetDelegationList)
+{
+  Link link("/test");
+  BOOST_CHECK_EQUAL(link.getDelegationList(), DelegationList());
+
+  link.setDelegationList(DelegationList({{10, "/test1"}, {20, "/test2"}}));
+  BOOST_CHECK_EQUAL(link.getDelegationList(), DelegationList({{10, "/test1"}, {20, "/test2"}}));
+}
+
+BOOST_AUTO_TEST_CASE(AddDelegation)
+{
+  Link link1("/test", {{10, "/test1"}, {20, "/test2"}, {100, "/test3"}});
+  BOOST_CHECK_EQUAL(link1.getDelegationList(),
+                    DelegationList({{10, "/test1"}, {20, "/test2"}, {100, "/test3"}}));
+
+  link1.addDelegation(30, "/test4");
+  BOOST_CHECK_EQUAL(link1.getDelegationList(),
+                    DelegationList({{10, "/test1"}, {20, "/test2"}, {30, "/test4"}, {100, "/test3"}}));
+
+  link1.addDelegation(40, "/test2");
+  BOOST_CHECK_EQUAL(link1.getDelegationList(),
+                    DelegationList({{10, "/test1"}, {30, "/test4"}, {40, "/test2"}, {100, "/test3"}}));
+
+  signData(link1);
+  Link link2(link1.wireEncode());
+  BOOST_CHECK_EQUAL(link2.getDelegationList(),
+                    DelegationList({{10, "/test1"}, {30, "/test4"}, {40, "/test2"}, {100, "/test3"}}));
+}
+
+BOOST_AUTO_TEST_CASE(RemoveDelegation)
+{
+  Link link1("/test", {{10, "/test1"}, {20, "/test2"}, {100, "/test3"}});
+  BOOST_CHECK_EQUAL(link1.getDelegationList(),
+                    DelegationList({{10, "/test1"}, {20, "/test2"}, {100, "/test3"}}));
+
+  link1.removeDelegation("/test4"); // non-existent
+  BOOST_CHECK_EQUAL(link1.getDelegationList(),
+                    DelegationList({{10, "/test1"}, {20, "/test2"}, {100, "/test3"}}));
+
+  link1.removeDelegation("/test2");
+  BOOST_CHECK_EQUAL(link1.getDelegationList(),
+                    DelegationList({{10, "/test1"}, {100, "/test3"}}));
+
+  signData(link1);
+  Link link2(link1.wireEncode());
+  BOOST_CHECK_EQUAL(link2.getDelegationList(),
+                    DelegationList({{10, "/test1"}, {100, "/test3"}}));
+
+  link1.removeDelegation("/test1");
+  link1.removeDelegation("/test3");
+  BOOST_CHECK_EQUAL(link1.getDelegationList(), DelegationList());
+}
+
+BOOST_AUTO_TEST_SUITE_END() // Modify
+
+BOOST_AUTO_TEST_SUITE(Deprecated)
+
+BOOST_AUTO_TEST_CASE(PairInitializerList)
+{
+  Link link("/test", {{10, "/test1"}, {20, "/test2"}, {100, "/test3"}});
+  Link::DelegationSet ds = link.getDelegations();
+  BOOST_REQUIRE_EQUAL(ds.size(), 3);
+  BOOST_CHECK_EQUAL(ds.begin()->first, 10);
+  BOOST_CHECK_EQUAL(ds.begin()->second, "/test1");
+}
+
+BOOST_AUTO_TEST_CASE(DelegationSet)
+{
+  Link link("/test", {{10, "/test1"}, {20, "/test2"}, {100, "/test3"}});
+  Link::DelegationSet ds = link.getDelegations();
+  BOOST_REQUIRE_EQUAL(ds.size(), 3);
+  BOOST_CHECK_EQUAL(ds.begin()->first, 10);
+  BOOST_CHECK_EQUAL(ds.begin()->second, "/test1");
+}
+
+BOOST_AUTO_TEST_CASE(FromWire)
+{
+  Block linkBlock(GOOD_LINK, sizeof(GOOD_LINK));
+
   BOOST_CHECK_EQUAL(Link::countDelegationsFromWire(linkBlock), 2);
+
+  auto del0 = Link::getDelegationFromWire(linkBlock, 0);
+  BOOST_CHECK_EQUAL(std::get<0>(del0), 10);
+  BOOST_CHECK_EQUAL(std::get<1>(del0), "/local");
+  auto del1 = Link::getDelegationFromWire(linkBlock, 1);
+  BOOST_CHECK_EQUAL(std::get<0>(del1), 20);
+  BOOST_CHECK_EQUAL(std::get<1>(del1), "/ndn");
+  BOOST_CHECK_THROW(Link::getDelegationFromWire(linkBlock, 2), std::out_of_range);
+
+  BOOST_CHECK_EQUAL(Link::findDelegationFromWire(linkBlock, "/local"), 0);
+  BOOST_CHECK_EQUAL(Link::findDelegationFromWire(linkBlock, "/none"), -1);
 }
 
-BOOST_AUTO_TEST_CASE(IncorrectContentType)
-{
-  Block linkBlock(IncorrectContentTypeLink, sizeof(IncorrectContentTypeLink));
-  Link link;
-  BOOST_REQUIRE_THROW(link.wireDecode(linkBlock), Link::Error);
-}
-
-BOOST_AUTO_TEST_CASE(MissingPreferenceEncoding)
-{
-  Block linkBlock(MissingPreferenceLink, sizeof(MissingPreferenceLink));
-  Link link;
-  BOOST_REQUIRE_THROW(link.wireDecode(linkBlock), Link::Error);
-}
-
-BOOST_AUTO_TEST_CASE(MissingNameEncoding)
-{
-  Block linkBlock(MissingNameLink, sizeof(MissingNameLink));
-  Link link;
-  BOOST_REQUIRE_THROW(link.wireDecode(linkBlock), Link::Error);
-}
+BOOST_AUTO_TEST_SUITE_END() // Deprecated
 
 BOOST_AUTO_TEST_SUITE_END() // TestLink
 
