diff --git a/src/encoding/tlv-nfd.hpp b/src/encoding/tlv-nfd.hpp
index 6888526..b72b731 100644
--- a/src/encoding/tlv-nfd.hpp
+++ b/src/encoding/tlv-nfd.hpp
@@ -16,6 +16,7 @@
 namespace tlv {
 namespace nfd {
 
+// NFD Management protocol
 enum {
   // ControlParameters
   ControlParameters   = 104,
@@ -25,30 +26,11 @@
   Cost                = 106,
   Strategy            = 107,
 
-  // (deprecated)
-  FibManagementOptions  = ControlParameters,
-  FaceManagementOptions = ControlParameters,
-  StrategyChoiceOptions = ControlParameters,
-
   // ControlResponse
   ControlResponse = 101,
   StatusCode      = 102,
   StatusText      = 103,
 
-  // FIB Enumeration Protocol
-  FibEntry        = 128,
-  NextHopRecord   = 129,
-
-  // Face Status Protocol
-  FaceStatus                   = 128,
-  TotalIncomingInterestCounter = 145,
-  TotalIncomingDataCounter     = 144,
-  TotalOutgoingInterestCounter = 146,
-  TotalOutgoingDataCounter     = 147,
-  FaceEventNotification        = 192,
-  FaceEventKind                = 193,
-  FaceFlags                    = 194,
-
   // ForwarderStatus
   NfdVersion           = 128,
   StartTimestamp       = 129,
@@ -61,7 +43,18 @@
   NInInterests         = 144,
   NInDatas             = 145,
   NOutInterests        = 146,
-  NOutDatas            = 147
+  NOutDatas            = 147,
+
+  // Face Management
+  FaceStatus            = 128,
+  LocalUri              = 129,
+  FaceFlags             = 194,
+  FaceEventNotification = 192,
+  FaceEventKind         = 193,
+
+  // FIB Management
+  FibEntry      = 128,
+  NextHopRecord = 129
 };
 
 enum {
diff --git a/src/management/nfd-face-event-notification.hpp b/src/management/nfd-face-event-notification.hpp
index 494475e..53640c8 100644
--- a/src/management/nfd-face-event-notification.hpp
+++ b/src/management/nfd-face-event-notification.hpp
@@ -1,48 +1,80 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /**
- * Copyright (C) 2014 Named Data Networking Project
+ * Copyright (C) 2013 Regents of the University of California.
  * See COPYING for copyright and distribution information.
  */
 
 #ifndef NDN_MANAGEMENT_NFD_FACE_EVENT_NOTIFICATION_HPP
 #define NDN_MANAGEMENT_NFD_FACE_EVENT_NOTIFICATION_HPP
 
-#include "../encoding/encoding-buffer.hpp"
+// This include must be kept as the first one, to ensure nfd-face-flags.hpp compiles on its own.
+#include "nfd-face-flags.hpp"
+
 #include "../encoding/tlv-nfd.hpp"
+#include "../encoding/encoding-buffer.hpp"
 
 namespace ndn {
 namespace nfd {
 
-enum FaceEventKind
-  {
-    FACE_EVENT_CREATED = 1,
-    FACE_EVENT_DESTROYED = 2
-  };
+enum FaceEventKind {
+  FACE_EVENT_CREATED = 1,
+  FACE_EVENT_DESTROYED = 2
+};
 
-enum FaceFlags
-  {
-    FACE_IS_LOCAL = 1,
-    FACE_IS_ON_DEMAND = 2
-    // FACE_? = 4
-    // FACE_? = 8
-  };
-
-class FaceEventNotification
+/** \brief represents a Face status change notification
+ *  \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Face-Status-Change-Notification
+ */
+class FaceEventNotification : public FaceFlagsTraits<FaceEventNotification>
 {
 public:
   class Error : public Tlv::Error
   {
   public:
-    Error(const std::string& what) : Tlv::Error(what) { }
+    explicit
+    Error(const std::string& what)
+      : Tlv::Error(what)
+    {
+    }
   };
 
-  FaceEventNotification(FaceEventKind eventKind,
-                        uint64_t faceId,
-                        const std::string& uri,
-                        uint64_t flags);
+  FaceEventNotification();
 
   explicit
-  FaceEventNotification(const Block& block);
+  FaceEventNotification(const Block& block)
+  {
+    this->wireDecode(block);
+  }
+
+  /** \brief prepend FaceEventNotification to the encoder
+   */
+  template<bool T>
+  size_t
+  wireEncode(EncodingImpl<T>& encoder) const;
+
+  /** \brief encode FaceEventNotification
+   */
+  const Block&
+  wireEncode() const;
+
+  /** \brief decode FaceEventNotification
+   */
+  void
+  wireDecode(const Block& wire);
+
+public: // getters & setters
+  FaceEventKind
+  getKind() const
+  {
+    return m_kind;
+  }
+
+  FaceEventNotification&
+  setKind(FaceEventKind kind)
+  {
+    m_wire.reset();
+    m_kind = kind;
+    return *this;
+  }
 
   uint64_t
   getFaceId() const
@@ -50,16 +82,40 @@
     return m_faceId;
   }
 
-  const std::string&
-  getUri() const
+  FaceEventNotification&
+  setFaceId(uint64_t faceId)
   {
-    return m_uri;
+    m_wire.reset();
+    m_faceId = faceId;
+    return *this;
   }
 
-  FaceEventKind
-  getEventKind() const
+  const std::string&
+  getRemoteUri() const
   {
-    return m_kind;
+    return m_remoteUri;
+  }
+
+  FaceEventNotification&
+  setRemoteUri(const std::string& remoteUri)
+  {
+    m_wire.reset();
+    m_remoteUri = remoteUri;
+    return *this;
+  }
+
+  const std::string&
+  getLocalUri() const
+  {
+    return m_localUri;
+  }
+
+  FaceEventNotification&
+  setLocalUri(const std::string& localUri)
+  {
+    m_wire.reset();
+    m_localUri = localUri;
+    return *this;
   }
 
   uint64_t
@@ -68,88 +124,94 @@
     return m_flags;
   }
 
-  bool
-  isLocal() const
+  FaceEventNotification&
+  setFlags(uint64_t flags)
   {
-    return m_flags & FACE_IS_LOCAL;
+    m_wire.reset();
+    m_flags = flags;
+    return *this;
   }
 
-  bool
-  isOnDemand() const
+public: // deprecated
+  /** \deprecated use default constructor and setters
+   */
+  FaceEventNotification(FaceEventKind kind,
+                        uint64_t faceId,
+                        const std::string& uri,
+                        uint64_t flags);
+
+  /** \deprecated
+   */
+  FaceEventKind
+  getEventKind() const
   {
-    return m_flags & FACE_IS_ON_DEMAND;
+    return this->getKind();
   }
 
-  template<bool T>
-  size_t
-  wireEncode(EncodingImpl<T>& buffer) const;
-
-  const Block&
-  wireEncode() const;
-
-  void
-  wireDecode(const Block& wire);
+  /** \deprecated
+   */
+  const std::string&
+  getUri() const
+  {
+    return this->getRemoteUri();
+  }
 
 private:
   FaceEventKind m_kind;
   uint64_t m_faceId;
-  std::string m_uri;
+  std::string m_remoteUri;
+  std::string m_localUri;
   uint64_t m_flags;
 
   mutable Block m_wire;
 };
 
 inline
-FaceEventNotification::FaceEventNotification(FaceEventKind eventKind,
-                                             uint64_t faceId,
-                                             const std::string& uri,
-                                             uint64_t flags)
-  : m_kind(eventKind)
-  , m_faceId(faceId)
-  , m_uri(uri)
-  , m_flags(flags)
+FaceEventNotification::FaceEventNotification()
+  : m_kind(static_cast<FaceEventKind>(0))
+  , m_faceId(0)
+  , m_flags(0)
 {
 }
 
 inline
-FaceEventNotification::FaceEventNotification(const Block& block)
+FaceEventNotification::FaceEventNotification(FaceEventKind kind,
+                                             uint64_t faceId,
+                                             const std::string& uri,
+                                             uint64_t flags)
 {
-  wireDecode(block);
+  (*this).setKind(kind)
+         .setFaceId(faceId)
+         .setRemoteUri(uri)
+         .setFlags(flags);
 }
 
 template<bool T>
-size_t
-FaceEventNotification::wireEncode(EncodingImpl<T>& buffer) const
+inline size_t
+FaceEventNotification::wireEncode(EncodingImpl<T>& encoder) const
 {
   size_t totalLength = 0;
 
-  totalLength += prependNonNegativeIntegerBlock(buffer,
-                                                tlv::nfd::FaceFlags,
-                                                m_flags);
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::FaceFlags, m_flags);
+  totalLength += prependByteArrayBlock(encoder, tlv::nfd::LocalUri,
+                 reinterpret_cast<const uint8_t*>(m_localUri.c_str()), m_localUri.size());
+  totalLength += prependByteArrayBlock(encoder, tlv::nfd::Uri,
+                 reinterpret_cast<const uint8_t*>(m_remoteUri.c_str()), m_remoteUri.size());
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::FaceId, m_faceId);
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::FaceEventKind, m_kind);
 
-  totalLength += prependByteArrayBlock(buffer,
-                                       tlv::nfd::Uri,
-                                       reinterpret_cast<const uint8_t*>(m_uri.c_str()),
-                                       m_uri.size());
-
-  totalLength += prependNonNegativeIntegerBlock(buffer,
-                                                tlv::nfd::FaceId,
-                                                m_faceId);
-
-  totalLength += prependNonNegativeIntegerBlock(buffer,
-                                                tlv::nfd::FaceEventKind,
-                                                static_cast<uint32_t>(m_kind));
-
-  totalLength += buffer.prependVarNumber(totalLength);
-  totalLength += buffer.prependVarNumber(tlv::nfd::FaceEventNotification);
-
+  totalLength += encoder.prependVarNumber(totalLength);
+  totalLength += encoder.prependVarNumber(tlv::nfd::FaceEventNotification);
   return totalLength;
 }
 
 inline const Block&
 FaceEventNotification::wireEncode() const
 {
-  if (m_wire.hasWire ())
+  if (m_wire.hasWire())
     return m_wire;
 
   EncodingEstimator estimator;
@@ -163,67 +225,76 @@
 }
 
 inline void
-FaceEventNotification::wireDecode (const Block &wire)
+FaceEventNotification::wireDecode(const Block& block)
 {
-  m_wire = wire;
-
-  if (m_wire.type() != tlv::nfd::FaceEventNotification)
-    throw Error("Requested decoding of FaceEventNotification, but Block is of different type");
-
+  if (block.type() != tlv::nfd::FaceEventNotification) {
+    throw Error("expecting FaceEventNotification block");
+  }
+  m_wire = block;
   m_wire.parse();
-
-  // FaceKind
   Block::element_const_iterator val = m_wire.elements_begin();
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::FaceEventKind)
-    throw Error("Missing required Uri block");
-  m_kind = static_cast<FaceEventKind>(readNonNegativeInteger(*val));
 
-  // FaceID
-  ++val;
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::FaceId)
-    throw Error("Missing required FaceId block");
-  m_faceId = readNonNegativeInteger(*val);
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceEventKind) {
+    m_kind = static_cast<FaceEventKind>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required FaceEventKind field");
+  }
 
-  // URI
-  ++val;
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::Uri)
-    throw Error("Missing required Uri block");
-  m_uri = std::string(reinterpret_cast<const char*>(val->value()), val->value_size());
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceId) {
+    m_faceId = static_cast<uint64_t>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required FaceId field");
+  }
 
-  // FaceFlags
-  ++val;
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::FaceFlags)
-    throw Error("Missing required FaceFlags block");
-  m_flags = readNonNegativeInteger(*val);
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::Uri) {
+    m_remoteUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
+    ++val;
+  }
+  else {
+    throw Error("missing required Uri field");
+  }
+
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::LocalUri) {
+    m_localUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
+    ++val;
+  }
+  else {
+    throw Error("missing required LocalUri field");
+  }
+
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceFlags) {
+    m_flags = static_cast<uint64_t>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required FaceFlags field");
+  }
 }
 
 inline std::ostream&
-operator << (std::ostream& os, const FaceEventNotification& event)
+operator<<(std::ostream& os, const FaceEventNotification& notification)
 {
   os << "FaceEventNotification(";
 
-  os << "Kind: ";
-  switch (event.getEventKind())
+  switch (notification.getKind())
     {
     case FACE_EVENT_CREATED:
-      os << "created";
+      os << "Kind: created, ";
       break;
     case FACE_EVENT_DESTROYED:
-      os << "destroyed";
+      os << "Kind: destroyed, ";
       break;
     }
-  os << ", ";
 
-  // FaceID
-  os << "FaceID: " << event.getFaceId() << ", ";
-
-  // URI
-  os << "Uri: " << event.getUri() << ", ";
-
-  // Flags
-  os << "Flags: " << event.getFlags();
-
-  os << ")";
+  os << "FaceID: " << notification.getFaceId() << ", "
+     << "RemoteUri: " << notification.getRemoteUri() << ", "
+     << "LocalUri: " << notification.getLocalUri() << ", "
+     << "Flags: " << notification.getFlags()
+     << ")";
   return os;
 }
 
diff --git a/src/management/nfd-face-flags.hpp b/src/management/nfd-face-flags.hpp
new file mode 100644
index 0000000..49baac7
--- /dev/null
+++ b/src/management/nfd-face-flags.hpp
@@ -0,0 +1,53 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_MANAGEMENT_NFD_FACE_FLAGS_HPP
+#define NDN_MANAGEMENT_NFD_FACE_FLAGS_HPP
+
+namespace ndn {
+namespace nfd {
+
+/** \class FaceFlags
+ *  \brief provides additional information about a face
+ */
+enum {
+  /** \brief face is local (for scope control purpose)
+   */
+  FACE_IS_LOCAL = 1,
+  /** \brief face is created on demand (accepted incoming connection,
+   *         not initiated outgoing connection)
+   */
+  FACE_IS_ON_DEMAND = 2
+  // FACE_? = 4
+  // FACE_? = 8
+};
+
+/** \brief implements getters to each face flag
+ *
+ *  \tparam T class containing a FaceFlags field and implements
+ *            `FaceFlags getFlags() const` method
+ */
+template<typename T>
+class FaceFlagsTraits
+{
+public:
+  bool
+  isLocal() const
+  {
+    return static_cast<const T*>(this)->getFlags() & FACE_IS_LOCAL;
+  }
+
+  bool
+  isOnDemand() const
+  {
+    return static_cast<const T*>(this)->getFlags() & FACE_IS_ON_DEMAND;
+  }
+};
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MANAGEMENT_NFD_FACE_FLAGS_HPP
diff --git a/src/management/nfd-face-status.hpp b/src/management/nfd-face-status.hpp
index f3abdb5..1c2e636 100644
--- a/src/management/nfd-face-status.hpp
+++ b/src/management/nfd-face-status.hpp
@@ -1,151 +1,290 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
 /**
- * Copyright (C) 2014 Named Data Networking Project
+ * Copyright (C) 2013 Regents of the University of California.
  * See COPYING for copyright and distribution information.
  */
 
 #ifndef NDN_MANAGEMENT_NFD_FACE_STATUS_HPP
 #define NDN_MANAGEMENT_NFD_FACE_STATUS_HPP
 
-#include "../encoding/encoding-buffer.hpp"
+// This include must be kept as the first one, to ensure nfd-face-flags.hpp compiles on its own.
+#include "nfd-face-flags.hpp"
+
 #include "../encoding/tlv-nfd.hpp"
+#include "../encoding/encoding-buffer.hpp"
 
 namespace ndn {
 namespace nfd {
 
-class FaceStatus
+/** \brief represents Face status
+ *  \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Face-Dataset
+ */
+class FaceStatus : public FaceFlagsTraits<FaceStatus>
 {
 public:
   class Error : public Tlv::Error
   {
   public:
-    Error(const std::string& what) : Tlv::Error(what) { }
+    explicit
+    Error(const std::string& what)
+      : Tlv::Error(what)
+    {
+    }
   };
 
-  FaceStatus(const uint64_t faceId,
-             const std::string& uri,
-             uint64_t inInterest, uint64_t inData, uint64_t outInterest, uint64_t outData);
+  FaceStatus();
 
   explicit
-  FaceStatus(const Block& block);
+  FaceStatus(const Block& block)
+  {
+    this->wireDecode(block);
+  }
 
+  /** \brief prepend FaceStatus to the encoder
+   */
+  template<bool T>
+  size_t
+  wireEncode(EncodingImpl<T>& encoder) const;
+
+  /** \brief encode FaceStatus
+   */
+  const Block&
+  wireEncode() const;
+
+  /** \brief decode FaceStatus
+   */
+  void
+  wireDecode(const Block& wire);
+
+public: // getters & setters
   uint64_t
   getFaceId() const
   {
     return m_faceId;
   }
 
+  FaceStatus&
+  setFaceId(uint64_t faceId)
+  {
+    m_wire.reset();
+    m_faceId = faceId;
+    return *this;
+  }
+
+  const std::string&
+  getRemoteUri() const
+  {
+    return m_remoteUri;
+  }
+
+  FaceStatus&
+  setRemoteUri(const std::string& remoteUri)
+  {
+    m_wire.reset();
+    m_remoteUri = remoteUri;
+    return *this;
+  }
+
+  const std::string&
+  getLocalUri() const
+  {
+    return m_localUri;
+  }
+
+  FaceStatus&
+  setLocalUri(const std::string& localUri)
+  {
+    m_wire.reset();
+    m_localUri = localUri;
+    return *this;
+  }
+
+  uint64_t
+  getFlags() const
+  {
+    return m_flags;
+  }
+
+  FaceStatus&
+  setFlags(uint64_t flags)
+  {
+    m_wire.reset();
+    m_flags = flags;
+    return *this;
+  }
+
+  uint64_t
+  getNInInterests() const
+  {
+    return m_nInInterests;
+  }
+
+  FaceStatus&
+  setNInInterests(uint64_t nInInterests)
+  {
+    m_wire.reset();
+    m_nInInterests = nInInterests;
+    return *this;
+  }
+
+  uint64_t
+  getNInDatas() const
+  {
+    return m_nInDatas;
+  }
+
+  FaceStatus&
+  setNInDatas(uint64_t nInDatas)
+  {
+    m_wire.reset();
+    m_nInDatas = nInDatas;
+    return *this;
+  }
+
+  uint64_t
+  getNOutInterests() const
+  {
+    return m_nOutInterests;
+  }
+
+  FaceStatus&
+  setNOutInterests(uint64_t nOutInterests)
+  {
+    m_wire.reset();
+    m_nOutInterests = nOutInterests;
+    return *this;
+  }
+
+  uint64_t
+  getNOutDatas() const
+  {
+    return m_nOutDatas;
+  }
+
+  FaceStatus&
+  setNOutDatas(uint64_t nOutDatas)
+  {
+    m_wire.reset();
+    m_nOutDatas = nOutDatas;
+    return *this;
+  }
+
+public: // deprecated
+  /** \deprecated
+   */
+  FaceStatus(const uint64_t faceId,
+             const std::string& uri,
+             uint64_t inInterest, uint64_t inData, uint64_t outInterest, uint64_t outData);
+
+  /** \deprecated
+   */
   const std::string&
   getUri() const
   {
-    return m_uri;
+    return this->getRemoteUri();
   }
 
+  /** \deprecated
+   */
   const uint64_t
   getInInterest() const
   {
-    return m_inInterest;
+    return this->getNInInterests();
   }
 
+  /** \deprecated
+   */
   const uint64_t
   getInData() const
   {
-    return m_inData;
+    return this->getNInDatas();
   }
 
+  /** \deprecated
+   */
   const uint64_t
   getOutInterest() const
   {
-    return m_outInterest;
+    return this->getNOutInterests();
   }
 
+  /** \deprecated
+   */
   const uint64_t
   getOutData() const
   {
-    return m_outData;
+    return this->getNOutDatas();
   }
 
-  template<bool T>
-  size_t
-  wireEncode(EncodingImpl<T>& buffer) const;
-
-  const Block&
-  wireEncode() const;
-
-  void
-  wireDecode(const Block& wire);
-
 private:
   uint64_t m_faceId;
-  std::string m_uri;
-  uint64_t m_inInterest;
-  uint64_t m_inData;
-  uint64_t m_outInterest;
-  uint64_t m_outData;
+  std::string m_remoteUri;
+  std::string m_localUri;
+  uint64_t m_flags;
+  uint64_t m_nInInterests;
+  uint64_t m_nInDatas;
+  uint64_t m_nOutInterests;
+  uint64_t m_nOutDatas;
 
   mutable Block m_wire;
 };
 
 inline
-FaceStatus::FaceStatus(const uint64_t faceId,
-             const std::string& uri,
-             uint64_t inInterest, uint64_t inData, uint64_t outInterest, uint64_t outData)
-  : m_faceId(faceId)
-  , m_uri(uri)
-  , m_inInterest(inInterest)
-  , m_inData(inData)
-  , m_outInterest(outInterest)
-  , m_outData(outData)
+FaceStatus::FaceStatus()
+  : m_faceId(0)
+  , m_flags(0)
+  , m_nInInterests(0)
+  , m_nInDatas(0)
+  , m_nOutInterests(0)
+  , m_nOutDatas(0)
 {
 }
 
 inline
-FaceStatus::FaceStatus(const Block& block)
+FaceStatus::FaceStatus(const uint64_t faceId,
+             const std::string& uri,
+             uint64_t inInterest, uint64_t inData, uint64_t outInterest, uint64_t outData)
 {
-  wireDecode(block);
+  (*this).setFaceId(faceId)
+         .setRemoteUri(uri)
+         .setNInInterests(inInterest)
+         .setNInDatas(inData)
+         .setNOutInterests(outInterest)
+         .setNOutDatas(outData);
 }
 
 template<bool T>
-size_t
-FaceStatus::wireEncode(EncodingImpl<T>& buffer) const
+inline size_t
+FaceStatus::wireEncode(EncodingImpl<T>& encoder) const
 {
   size_t totalLength = 0;
 
-  totalLength += prependNonNegativeIntegerBlock(buffer,
-                                                tlv::nfd::TotalOutgoingDataCounter,
-                                                m_outData);
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::NOutDatas, m_nOutDatas);
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::NOutInterests, m_nOutInterests);
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::NInDatas, m_nInDatas);
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::NInInterests, m_nInInterests);
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::FaceFlags, m_flags);
+  totalLength += prependByteArrayBlock(encoder, tlv::nfd::LocalUri,
+                 reinterpret_cast<const uint8_t*>(m_localUri.c_str()), m_localUri.size());
+  totalLength += prependByteArrayBlock(encoder, tlv::nfd::Uri,
+                 reinterpret_cast<const uint8_t*>(m_remoteUri.c_str()), m_remoteUri.size());
+  totalLength += prependNonNegativeIntegerBlock(encoder,
+                 tlv::nfd::FaceId, m_faceId);
 
-  totalLength += prependNonNegativeIntegerBlock(buffer,
-                                                tlv::nfd::TotalOutgoingInterestCounter,
-                                                m_outInterest);
-
-  totalLength += prependNonNegativeIntegerBlock(buffer,
-                                                tlv::nfd::TotalIncomingDataCounter,
-                                                m_inData);
-
-  totalLength += prependNonNegativeIntegerBlock(buffer,
-                                                tlv::nfd::TotalIncomingInterestCounter,
-                                                m_inInterest);
-
-  totalLength += prependByteArrayBlock(buffer,
-                                       tlv::nfd::Uri,
-                                       reinterpret_cast<const uint8_t*>(m_uri.c_str()),
-                                       m_uri.size());
-
-  totalLength += prependNonNegativeIntegerBlock(buffer,
-                                                tlv::nfd::FaceId,
-                                                m_faceId);
-
-  totalLength += buffer.prependVarNumber(totalLength);
-  totalLength += buffer.prependVarNumber(tlv::nfd::FaceStatus);
-
+  totalLength += encoder.prependVarNumber(totalLength);
+  totalLength += encoder.prependVarNumber(tlv::nfd::FaceStatus);
   return totalLength;
 }
 
-const Block&
+inline const Block&
 FaceStatus::wireEncode() const
 {
-  if (m_wire.hasWire ())
+  if (m_wire.hasWire())
     return m_wire;
 
   EncodingEstimator estimator;
@@ -159,71 +298,95 @@
 }
 
 inline void
-FaceStatus::wireDecode(const Block &wire)
+FaceStatus::wireDecode(const Block& block)
 {
-  m_wire = wire;
-
-  if (m_wire.type() != tlv::nfd::FaceStatus)
-    throw Error("Requested decoding of FaceStatus, but Block is of different type");
-
+  if (block.type() != tlv::nfd::FaceStatus) {
+    throw Error("expecting FaceStatus block");
+  }
+  m_wire = block;
   m_wire.parse();
-
-  // FaceKind
   Block::element_const_iterator val = m_wire.elements_begin();
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::FaceId)
-    throw Error("Missing required FaceId block");
-  m_faceId = readNonNegativeInteger(*val);
 
-  // URI
-  ++val;
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::Uri)
-    throw Error("Missing required Uri block");
-  m_uri = std::string(reinterpret_cast<const char*>(val->value()), val->value_size());
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceId) {
+    m_faceId = static_cast<uint64_t>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required FaceId field");
+  }
 
-  // TotalIncomingInterestCounter
-  ++val;
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::TotalIncomingInterestCounter)
-    throw Error("Missing required FaceId block");
-  m_inInterest = readNonNegativeInteger(*val);
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::Uri) {
+    m_remoteUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
+    ++val;
+  }
+  else {
+    throw Error("missing required Uri field");
+  }
 
-  // TotalIncomingDataCounter
-  ++val;
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::TotalIncomingDataCounter)
-    throw Error("Missing required FaceId block");
-  m_inData = readNonNegativeInteger(*val);
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::LocalUri) {
+    m_localUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
+    ++val;
+  }
+  else {
+    throw Error("missing required LocalUri field");
+  }
 
-  // TotalOutgoingInterestCounter
-  ++val;
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::TotalOutgoingInterestCounter)
-    throw Error("Missing required FaceId block");
-  m_outInterest = readNonNegativeInteger(*val);
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceFlags) {
+    m_flags = static_cast<uint64_t>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required FaceFlags field");
+  }
 
-  // TotalOutgoingDataCounter
-  ++val;
-  if (val == m_wire.elements_end() || val->type() != tlv::nfd::TotalOutgoingDataCounter)
-    throw Error("Missing required FaceId block");
-  m_outData = readNonNegativeInteger(*val);
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInInterests) {
+    m_nInInterests = static_cast<uint64_t>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required NInInterests field");
+  }
+
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInDatas) {
+    m_nInDatas = static_cast<uint64_t>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required NInDatas field");
+  }
+
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutInterests) {
+    m_nOutInterests = static_cast<uint64_t>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required NOutInterests field");
+  }
+
+  if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutDatas) {
+    m_nOutDatas = static_cast<uint64_t>(readNonNegativeInteger(*val));
+    ++val;
+  }
+  else {
+    throw Error("missing required NOutDatas field");
+  }
 }
 
 inline std::ostream&
-operator << (std::ostream& os, const FaceStatus& status)
+operator<<(std::ostream& os, const FaceStatus& status)
 {
-  os << "FaceStatus(";
-
-  // FaceID
-  os << "FaceID: " << status.getFaceId() << ", ";
-
-  // URI
-  os << "Uri: " << status.getUri() << ", ";
-
-  os << "Counters: " << status.getInInterest() << "|" << status.getInData()
-     << "|" << status.getOutInterest() << "|" << status.getOutData();
-
-  os << ")";
+  os << "FaceStatus("
+     << "FaceID: " << status.getFaceId() << ", "
+     << "RemoteUri: " << status.getRemoteUri() << ", "
+     << "LocalUri: " << status.getLocalUri() << ", "
+     << "Flags: " << status.getFlags() << ", "
+     << "Counters: " << status.getNInInterests() << "|" << status.getNInDatas()
+     << "|" << status.getNOutInterests() << "|" << status.getNOutDatas()
+     << ")";
   return os;
 }
 
 } // namespace nfd
 } // namespace ndn
 
-#endif // NDN_MANAGEMENT_NFD_FACE_EVENT_STATUS_HPP
+#endif // NDN_MANAGEMENT_NFD_FACE_STATUS_HPP
diff --git a/src/management/nfd-forwarder-status.hpp b/src/management/nfd-forwarder-status.hpp
index de8a93b..af1e05a 100644
--- a/src/management/nfd-forwarder-status.hpp
+++ b/src/management/nfd-forwarder-status.hpp
@@ -8,7 +8,6 @@
 #define NDN_MANAGEMENT_NFD_FORWARDER_STATUS_HPP
 
 #include "../encoding/tlv-nfd.hpp"
-#include "../encoding/tlv.hpp"
 #include "../encoding/encoding-buffer.hpp"
 
 namespace ndn {
@@ -260,8 +259,8 @@
   , m_nInDatas(0)
   , m_nOutInterests(0)
   , m_nOutDatas(0)
-  {
-  }
+{
+}
 
 template<bool T>
 inline size_t
@@ -318,21 +317,8 @@
 inline void
 ForwarderStatus::wireDecode(const Block& block)
 {
-  m_nfdVersion = 0;
-  m_startTimestamp = time::system_clock::TimePoint::min();
-  m_currentTimestamp = time::system_clock::TimePoint::min();
-  m_nNameTreeEntries = 0;
-  m_nFibEntries = 0;
-  m_nPitEntries = 0;
-  m_nMeasurementsEntries = 0;
-  m_nCsEntries = 0;
-  m_nInInterests = 0;
-  m_nInDatas = 0;
-  m_nOutInterests = 0;
-  m_nOutDatas = 0;
-
   if (block.type() != Tlv::Content) {
-    throw Error("Requested decoding of Status Payload, but block is not Content");
+    throw Error("expecting Content block for Status payload");
   }
   m_wire = block;
   m_wire.parse();
diff --git a/tests/management/nfd-face-event-notification.cpp b/tests/management/nfd-face-event-notification.cpp
new file mode 100644
index 0000000..76be7c4
--- /dev/null
+++ b/tests/management/nfd-face-event-notification.cpp
@@ -0,0 +1,128 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "management/nfd-face-event-notification.hpp"
+
+#include <boost/test/unit_test.hpp>
+
+namespace ndn {
+namespace nfd {
+
+BOOST_AUTO_TEST_SUITE(NfdFaceEventNotification)
+
+BOOST_AUTO_TEST_CASE(Flags)
+{
+  FaceEventNotification notification;
+
+  notification.setFlags(0);
+  BOOST_CHECK_EQUAL(notification.isLocal(), false);
+  BOOST_CHECK_EQUAL(notification.isOnDemand(), false);
+
+  notification.setFlags(FACE_IS_LOCAL);
+  BOOST_CHECK_EQUAL(notification.isLocal(), true);
+  BOOST_CHECK_EQUAL(notification.isOnDemand(), false);
+
+  notification.setFlags(FACE_IS_ON_DEMAND);
+  BOOST_CHECK_EQUAL(notification.isLocal(), false);
+  BOOST_CHECK_EQUAL(notification.isOnDemand(), true);
+
+  notification.setFlags(FACE_IS_LOCAL | FACE_IS_ON_DEMAND);
+  BOOST_CHECK_EQUAL(notification.isLocal(), true);
+  BOOST_CHECK_EQUAL(notification.isOnDemand(), true);
+}
+
+BOOST_AUTO_TEST_CASE(EncodeCreated)
+{
+  FaceEventNotification notification1;
+  notification1.setKind(FACE_EVENT_CREATED)
+               .setFaceId(20)
+               .setRemoteUri("tcp4://192.0.2.1:55555")
+               .setLocalUri("tcp4://192.0.2.2:6363")
+               .setFlags(FACE_IS_ON_DEMAND);
+  Block wire;
+  BOOST_REQUIRE_NO_THROW(wire = notification1.wireEncode());
+
+  // These octets are obtained by the snippet below.
+  // This check is intended to detect unexpected encoding change in the future.
+  //for (Buffer::const_iterator it = wire.begin(); it != wire.end(); ++it) {
+  //  printf("0x%02x, ", *it);
+  //}
+  static const uint8_t expected[] = {
+    0xc0, 0x38, 0xc1, 0x01, 0x01, 0x69, 0x01, 0x14, 0x72, 0x16, 0x74, 0x63,
+    0x70, 0x34, 0x3a, 0x2f, 0x2f, 0x31, 0x39, 0x32, 0x2e, 0x30, 0x2e, 0x32,
+    0x2e, 0x31, 0x3a, 0x35, 0x35, 0x35, 0x35, 0x35, 0x81, 0x15, 0x74, 0x63,
+    0x70, 0x34, 0x3a, 0x2f, 0x2f, 0x31, 0x39, 0x32, 0x2e, 0x30, 0x2e, 0x32,
+    0x2e, 0x32, 0x3a, 0x36, 0x33, 0x36, 0x33, 0xc2, 0x01, 0x02,
+  };
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
+                                  wire.begin(), wire.end());
+
+  BOOST_REQUIRE_NO_THROW(FaceEventNotification(wire));
+  FaceEventNotification notification2(wire);
+  BOOST_CHECK_EQUAL(notification1.getKind(), notification2.getKind());
+  BOOST_CHECK_EQUAL(notification1.getFaceId(), notification2.getFaceId());
+  BOOST_CHECK_EQUAL(notification1.getRemoteUri(), notification2.getRemoteUri());
+  BOOST_CHECK_EQUAL(notification1.getLocalUri(), notification2.getLocalUri());
+  BOOST_CHECK_EQUAL(notification1.getFlags(), notification2.getFlags());
+
+  std::ostringstream os;
+  os << notification2;
+  BOOST_CHECK_EQUAL(os.str(), "FaceEventNotification("
+                              "Kind: created, "
+                              "FaceID: 20, "
+                              "RemoteUri: tcp4://192.0.2.1:55555, "
+                              "LocalUri: tcp4://192.0.2.2:6363, "
+                              "Flags: 2)");
+}
+
+BOOST_AUTO_TEST_CASE(EncodeDestroyed)
+{
+  FaceEventNotification notification1;
+  notification1.setKind(FACE_EVENT_DESTROYED)
+               .setFaceId(20)
+               .setRemoteUri("tcp4://192.0.2.1:55555")
+               .setLocalUri("tcp4://192.0.2.2:6363")
+               .setFlags(FACE_IS_ON_DEMAND);
+  Block wire;
+  BOOST_REQUIRE_NO_THROW(wire = notification1.wireEncode());
+
+  // These octets are obtained by the snippet below.
+  // This check is intended to detect unexpected encoding change in the future.
+  //for (Buffer::const_iterator it = wire.begin(); it != wire.end(); ++it) {
+  //  printf("0x%02x, ", *it);
+  //}
+  static const uint8_t expected[] = {
+    0xc0, 0x38, 0xc1, 0x01, 0x02, 0x69, 0x01, 0x14, 0x72, 0x16, 0x74, 0x63,
+    0x70, 0x34, 0x3a, 0x2f, 0x2f, 0x31, 0x39, 0x32, 0x2e, 0x30, 0x2e, 0x32,
+    0x2e, 0x31, 0x3a, 0x35, 0x35, 0x35, 0x35, 0x35, 0x81, 0x15, 0x74, 0x63,
+    0x70, 0x34, 0x3a, 0x2f, 0x2f, 0x31, 0x39, 0x32, 0x2e, 0x30, 0x2e, 0x32,
+    0x2e, 0x32, 0x3a, 0x36, 0x33, 0x36, 0x33, 0xc2, 0x01, 0x02,
+  };
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
+                                  wire.begin(), wire.end());
+
+  BOOST_REQUIRE_NO_THROW(FaceEventNotification(wire));
+  FaceEventNotification notification2(wire);
+  BOOST_CHECK_EQUAL(notification1.getKind(), notification2.getKind());
+  BOOST_CHECK_EQUAL(notification1.getFaceId(), notification2.getFaceId());
+  BOOST_CHECK_EQUAL(notification1.getRemoteUri(), notification2.getRemoteUri());
+  BOOST_CHECK_EQUAL(notification1.getLocalUri(), notification2.getLocalUri());
+  BOOST_CHECK_EQUAL(notification1.getFlags(), notification2.getFlags());
+
+  std::ostringstream os;
+  os << notification2;
+  BOOST_CHECK_EQUAL(os.str(), "FaceEventNotification("
+                              "Kind: destroyed, "
+                              "FaceID: 20, "
+                              "RemoteUri: tcp4://192.0.2.1:55555, "
+                              "LocalUri: tcp4://192.0.2.2:6363, "
+                              "Flags: 2)");
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace nfd
+} // namespace ndn
diff --git a/tests/management/nfd-face-status.cpp b/tests/management/nfd-face-status.cpp
new file mode 100644
index 0000000..08b5fb0
--- /dev/null
+++ b/tests/management/nfd-face-status.cpp
@@ -0,0 +1,70 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "management/nfd-face-status.hpp"
+
+#include <boost/test/unit_test.hpp>
+
+namespace ndn {
+namespace nfd {
+
+BOOST_AUTO_TEST_SUITE(NfdFaceStatus)
+
+BOOST_AUTO_TEST_CASE(Encode)
+{
+  FaceStatus status1;
+  status1.setFaceId(100)
+         .setRemoteUri("tcp4://192.0.2.1:6363")
+         .setLocalUri("tcp4://192.0.2.2:55555")
+         .setFlags(FACE_IS_ON_DEMAND)
+         .setNInInterests(10)
+         .setNInDatas(200)
+         .setNOutInterests(3000)
+         .setNOutDatas(4);
+
+  Block wire;
+  BOOST_REQUIRE_NO_THROW(wire = status1.wireEncode());
+
+  // These octets are obtained by the snippet below.
+  // This check is intended to detect unexpected encoding change in the future.
+  //for (Buffer::const_iterator it = wire.begin(); it != wire.end(); ++it) {
+  //  printf("0x%02x, ", *it);
+  //}
+  static const uint8_t expected[] = {
+    0x80, 0x42, 0x69, 0x01, 0x64, 0x72, 0x15, 0x74, 0x63, 0x70, 0x34, 0x3a,
+    0x2f, 0x2f, 0x31, 0x39, 0x32, 0x2e, 0x30, 0x2e, 0x32, 0x2e, 0x31, 0x3a,
+    0x36, 0x33, 0x36, 0x33, 0x81, 0x16, 0x74, 0x63, 0x70, 0x34, 0x3a, 0x2f,
+    0x2f, 0x31, 0x39, 0x32, 0x2e, 0x30, 0x2e, 0x32, 0x2e, 0x32, 0x3a, 0x35,
+    0x35, 0x35, 0x35, 0x35, 0xc2, 0x01, 0x02, 0x90, 0x01, 0x0a, 0x91, 0x01,
+    0xc8, 0x92, 0x02, 0x0b, 0xb8, 0x93, 0x01, 0x04
+  };
+  BOOST_REQUIRE_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
+                                  wire.begin(), wire.end());
+
+  BOOST_REQUIRE_NO_THROW(FaceStatus(wire));
+  FaceStatus status2(wire);
+  BOOST_CHECK_EQUAL(status1.getFaceId(), status2.getFaceId());
+  BOOST_CHECK_EQUAL(status1.getRemoteUri(), status2.getRemoteUri());
+  BOOST_CHECK_EQUAL(status1.getLocalUri(), status2.getLocalUri());
+  BOOST_CHECK_EQUAL(status1.getFlags(), status2.getFlags());
+  BOOST_CHECK_EQUAL(status1.getNInInterests(), status2.getNInInterests());
+  BOOST_CHECK_EQUAL(status1.getNInDatas(), status2.getNInDatas());
+  BOOST_CHECK_EQUAL(status1.getNOutInterests(), status2.getNOutInterests());
+  BOOST_CHECK_EQUAL(status1.getNOutDatas(), status2.getNOutDatas());
+
+  std::ostringstream os;
+  os << status2;
+  BOOST_CHECK_EQUAL(os.str(), "FaceStatus(FaceID: 100, "
+                              "RemoteUri: tcp4://192.0.2.1:6363, "
+                              "LocalUri: tcp4://192.0.2.2:55555, "
+                              "Flags: 2, "
+                              "Counters: 10|200|3000|4)");
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace nfd
+} // namespace ndn
diff --git a/tests/management/nfd-forwarder-status.cpp b/tests/management/nfd-forwarder-status.cpp
index 123459e..d881ad1 100644
--- a/tests/management/nfd-forwarder-status.cpp
+++ b/tests/management/nfd-forwarder-status.cpp
@@ -5,7 +5,6 @@
  */
 
 #include "management/nfd-forwarder-status.hpp"
-// Having a separate compilation unit is necessary to ensure .hpp can compile on its own.
 #include "data.hpp"
 
 #include <boost/test/unit_test.hpp>
@@ -31,13 +30,12 @@
   status1.setNOutInterests(952144445);
   status1.setNOutDatas(138198826);
 
-  EncodingBuffer buffer;
-  status1.wireEncode(buffer);
-  Block wire = buffer.block();
+  Block wire;
+  BOOST_REQUIRE_NO_THROW(wire = status1.wireEncode());
 
   // These octets are obtained by the snippet below.
   // This check is intended to detect unexpected encoding change in the future.
-  //for (Buffer::iterator it = buffer.begin(); it != buffer.end(); ++it) {
+  //for (Buffer::const_iterator it = wire.begin(); it != wire.end(); ++it) {
   //  printf("0x%02x, ", *it);
   //}
   static const uint8_t expected[] = {
@@ -55,6 +53,7 @@
   Data data;
   data.setContent(wire);
 
+  BOOST_REQUIRE_NO_THROW(ForwarderStatus(data.getContent()));
   ForwarderStatus status2(data.getContent());
   BOOST_CHECK_EQUAL(status1.getNfdVersion(), status2.getNfdVersion());
   BOOST_CHECK_EQUAL(status1.getStartTimestamp(), status2.getStartTimestamp());
diff --git a/tests/management/test-nfd-control.cpp b/tests/management/test-nfd-control.cpp
index 6e3de4d..68eece2 100644
--- a/tests/management/test-nfd-control.cpp
+++ b/tests/management/test-nfd-control.cpp
@@ -7,8 +7,6 @@
 #include "management/nfd-control-response.hpp"
 #include "management/nfd-fib-management-options.hpp"
 #include "management/nfd-face-management-options.hpp"
-#include "management/nfd-face-event-notification.hpp"
-#include "management/nfd-face-status.hpp"
 
 #include <boost/test/unit_test.hpp>
 #include <boost/test/output_test_stream.hpp>
@@ -41,19 +39,6 @@
   0x6c, 0x6f, 0x2f, 0x77, 0x6f, 0x72, 0x6c, 0x64
 };
 
-const uint8_t TestFaceEventNotification[] = {
-  0xc0, 0x20, 0xc1, 0x01, 0x01, 0x69, 0x01, 0x64, 0x72, 0x15, 0x74, 0x63,
-  0x70, 0x34, 0x3a, 0x2f, 0x2f, 0x31, 0x32, 0x37, 0x2e, 0x30, 0x2e, 0x30,
-  0x2e, 0x31, 0x3a, 0x36, 0x33, 0x36, 0x33, 0xc2, 0x01, 0x03
-};
-
-const uint8_t TestFaceStatus[] = {
-  0x80, 0x27, 0x69, 0x01, 0x64, 0x72, 0x15, 0x74, 0x63, 0x70, 0x34, 0x3a,
-  0x2f, 0x2f, 0x31, 0x32, 0x37, 0x2e, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x3a,
-  0x36, 0x33, 0x36, 0x33, 0x91, 0x01, 0x0a, 0x90, 0x01, 0x14, 0x92, 0x01,
-  0x1e, 0x93, 0x02, 0x01, 0x90
-};
-
 // ControlResponse
 
 BOOST_AUTO_TEST_CASE(ControlResponseEncode)
@@ -161,71 +146,6 @@
 }
 
 
-BOOST_AUTO_TEST_CASE(FaceEventNotificationEncodingDecoding)
-{
-  FaceEventKind expectedKind = FACE_EVENT_CREATED;
-  std::string expectedUri("tcp4://127.0.0.1:6363");
-  uint64_t expectedFaceId = 100;
-  uint64_t expectedFlags = 3;
-
-  {
-    FaceEventNotification faceEvent(expectedKind, expectedFaceId, expectedUri, expectedFlags);
-    BOOST_REQUIRE_NO_THROW(faceEvent.wireEncode());
-
-    BOOST_REQUIRE_EQUAL_COLLECTIONS(TestFaceEventNotification,
-                                    TestFaceEventNotification + sizeof(TestFaceEventNotification),
-                                    faceEvent.wireEncode().begin(), faceEvent.wireEncode().end());
-
-    std::ostringstream os;
-    os << faceEvent;
-    BOOST_CHECK_EQUAL(os.str(), "FaceEventNotification(Kind: created, FaceID: 100, Uri: tcp4://127.0.0.1:6363, Flags: 3)");
-  }
-
-  {
-    Block blk(TestFaceEventNotification, sizeof(TestFaceEventNotification));
-    FaceEventNotification faceEvent(blk);
-
-    BOOST_CHECK_EQUAL(faceEvent.getEventKind(), expectedKind);
-    BOOST_CHECK_EQUAL(faceEvent.getFaceId(), expectedFaceId);
-    BOOST_CHECK_EQUAL(faceEvent.getUri(), expectedUri);
-    BOOST_CHECK_EQUAL(faceEvent.getFlags(), expectedFlags);
-    BOOST_CHECK(faceEvent.isLocal());
-    BOOST_CHECK(faceEvent.isOnDemand());
-  }
-}
-
-BOOST_AUTO_TEST_CASE(FaceStatusEncodingDecoding)
-{
-  {
-    FaceStatus faceStatus(100, "tcp4://127.0.0.1:6363", 10, 20, 30, 400);
-    BOOST_REQUIRE_NO_THROW(faceStatus.wireEncode());
-
-    BOOST_CHECK_EQUAL_COLLECTIONS(TestFaceStatus,
-                                  TestFaceStatus + sizeof(TestFaceStatus),
-                                  faceStatus.wireEncode().begin(), faceStatus.wireEncode().end());
-
-    std::ostringstream os;
-    os << faceStatus;
-    BOOST_CHECK_EQUAL(os.str(), "FaceStatus(FaceID: 100, Uri: tcp4://127.0.0.1:6363, "
-                      "Counters: 10|20|30|400)");
-  }
-
-  {
-    Block block(TestFaceStatus, sizeof(TestFaceStatus));
-    BOOST_REQUIRE_NO_THROW((FaceStatus(block)));
-
-    FaceStatus faceStatus(block);
-
-    BOOST_CHECK_EQUAL(faceStatus.getFaceId(), 100);
-    BOOST_CHECK_EQUAL(faceStatus.getUri(), "tcp4://127.0.0.1:6363");
-
-    BOOST_CHECK_EQUAL(faceStatus.getInInterest(),  10);
-    BOOST_CHECK_EQUAL(faceStatus.getInData(),      20);
-    BOOST_CHECK_EQUAL(faceStatus.getOutInterest(), 30);
-    BOOST_CHECK_EQUAL(faceStatus.getOutData(),     400);
-  }
-}
-
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace nfd
