diff --git a/src/test/java/com/intel/jndn/utils/ClientTest.java b/src/test/java/com/intel/jndn/utils/ClientTest.java
index 0ac93b5..62b67d5 100644
--- a/src/test/java/com/intel/jndn/utils/ClientTest.java
+++ b/src/test/java/com/intel/jndn/utils/ClientTest.java
@@ -20,50 +20,68 @@
 import net.named_data.jndn.Face;
 import net.named_data.jndn.Name;
 import net.named_data.jndn.util.Blob;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 /**
  *
  * @author Andrew Brown <andrew.brown@intel.com>
  */
 public class ClientTest {
+  
+  
+  /**
+   * Setup logging
+   */
+  private static final Logger logger = LogManager.getLogger();
 
-	@Test
-	public void testGetSync() {
-		// setup face
-		MockTransport transport = new MockTransport();
-		Face face = new Face(transport, null);
+  /**
+   * Test retrieving data synchronously
+   */
+  @Test
+  public void testGetSync() {
+    // setup face
+    MockTransport transport = new MockTransport();
+    Face face = new Face(transport, null);
 
-		// setup return data
-		Data response = new Data(new Name("/a/b/c"));
-		response.setContent(new Blob("..."));
-		transport.respondWith(response);
+    // setup return data
+    Data response = new Data(new Name("/a/b/c"));
+    response.setContent(new Blob("..."));
+    transport.respondWith(response);
 
-		// retrieve data
-		Client client = new Client();
-		Data data = client.getSync(face, new Name("/a/b/c"));
-		assertEquals(new Blob("...").buf(), data.getContent().buf());
-	}
+    // retrieve data
+    logger.info("Client expressing interest synchronously: /a/b/c");
+    Client client = new Client();
+    Data data = client.getSync(face, new Name("/a/b/c"));
+    assertEquals(new Blob("...").buf(), data.getContent().buf());
+  }
 
-	@Test
-	public void testGetAsync() throws InterruptedException {
-		// setup face
-		MockTransport transport = new MockTransport();
-		Face face = new Face(transport, null);
+  /**
+   * Test retrieving data asynchronously
+   * 
+   * @throws InterruptedException 
+   */
+  @Test
+  public void testGetAsync() throws InterruptedException {
+    // setup face
+    MockTransport transport = new MockTransport();
+    Face face = new Face(transport, null);
 
-		// setup return data
-		Data response = new Data(new Name("/a/b/c"));
-		response.setContent(new Blob("..."));
-		transport.respondWith(response);
+    // setup return data
+    Data response = new Data(new Name("/a/b/c"));
+    response.setContent(new Blob("..."));
+    transport.respondWith(response);
 
-		// retrieve data
-		Client client = new Client();
-		ClientObserver observer = client.get(face, new Name("/a/b/c"));
-		
-		// wait 
-		while(observer.responses() == 0){
-			Thread.sleep(10);
-		}
-		Data data = (Data) observer.getFirst().getPacket();
-		assertEquals(new Blob("...").buf(), data.getContent().buf());
-	}
+    // retrieve data
+    logger.info("Client expressing interest asynchronously: /a/b/c");
+    Client client = new Client();
+    ClientObserver observer = client.get(face, new Name("/a/b/c"));
+
+    // wait 
+    while (observer.responses() == 0) {
+      Thread.sleep(10);
+    }
+    Data data = (Data) observer.getFirst().getPacket();
+    assertEquals(new Blob("...").buf(), data.getContent().buf());
+  }
 }
diff --git a/src/test/java/com/intel/jndn/utils/PublisherTest.java b/src/test/java/com/intel/jndn/utils/PublisherTest.java
new file mode 100644
index 0000000..3c780ef
--- /dev/null
+++ b/src/test/java/com/intel/jndn/utils/PublisherTest.java
@@ -0,0 +1,120 @@
+/*
+ * File name: PublisherTest.java
+ * 
+ * Purpose: 
+ * 
+ * © Copyright Intel Corporation. All rights reserved.
+ * Intel Corporation, 2200 Mission College Boulevard,
+ * Santa Clara, CA 95052-8119, USA
+ */
+package com.intel.jndn.utils;
+
+import com.intel.jndn.mock.MockTransport;
+import java.io.IOException;
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Face;
+import net.named_data.jndn.Name;
+import net.named_data.jndn.encoding.EncodingException;
+import net.named_data.jndn.encoding.tlv.Tlv;
+import net.named_data.jndn.encoding.tlv.TlvEncoder;
+import net.named_data.jndn.security.SecurityException;
+import net.named_data.jndn.util.Blob;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author Andrew Brown <andrew.brown@intel.com>
+ */
+public class PublisherTest {
+
+  /**
+   * Test of publish method, of class Publisher.
+   */
+  @Test
+  public void testPublishSubscribe() throws IOException, EncodingException, InterruptedException, SecurityException {
+    MockTransport transport = new MockTransport();
+    Face face = new Face(transport, null);
+    final Counter counter = new Counter();
+
+    // setup subscriber
+    Subscriber subscriber = new Subscriber(face, new Name("/test/channel"));
+    subscriber.addType("example", TestExample.class);
+    subscriber.on(TestExample.class, new Subscriber.OnPublish<TestExample>() {
+      @Override
+      public void onPublish(TestExample publishedObject) {
+        counter.inc();
+        assertEquals(1, publishedObject.a);
+        assertEquals(true, publishedObject.b);
+      }
+    });
+
+    // setup publisher
+    Publisher publisher = new Publisher(face, new Name("/test/channel"), false);
+    publisher.addType("example", TestExample.class);
+    publisher.publish(new TestExample(1, true));
+
+    // process events
+    while(counter.get() == 0){
+      Thread.sleep(10);
+    }
+    
+    // check
+    assertEquals(1, counter.get());
+  }
+  
+   public Data fakeManagementSuccess(Name forName, int statusCode, String statusText){
+    TlvEncoder encoder = new TlvEncoder(1500);
+    int saveLength = encoder.getLength();
+
+    // encode backwards
+    encoder.writeBlobTlv(Tlv.NfdCommand_StatusText, new Blob(statusText).buf());
+    encoder.writeNonNegativeIntegerTlv(Tlv.NfdCommand_StatusCode, statusCode);
+    encoder.writeTypeAndLength(Tlv.NfdCommand_ControlResponse, encoder.getLength() - saveLength);
+    Blob content = new Blob(encoder.getOutput(), false);
+    
+    // now create data packet
+    Data data = new Data(forName);
+    data.setContent(content);
+    return data;
+  }
+
+  class TestExample {
+
+    int a;
+    boolean b;
+
+    public TestExample(int a, boolean b) {
+      this.a = a;
+      this.b = b;
+    }
+  }
+
+  /**
+   * Count reference
+   */
+  class Counter {
+
+    int count = 0;
+
+    public void inc() {
+      count++;
+    }
+
+    public int get() {
+      return count;
+    }
+  }
+
+//  /**
+//   * Test of clearOldPublished method, of class Publisher.
+//   */
+//  @Test
+//  public void testClearOldPublished() {
+//    System.out.println("clearOldPublished");
+//    Publisher instance = null;
+//    instance.clearOldPublished();
+//    // TODO review the generated test code and remove the default call to fail.
+//    fail("The test case is a prototype.");
+//  }
+}
