diff --git a/src/test/java/com/intel/jndn/utils/SegmentedClientTest.java b/src/test/java/com/intel/jndn/utils/SegmentedClientTest.java
index a08f3af..56231db 100644
--- a/src/test/java/com/intel/jndn/utils/SegmentedClientTest.java
+++ b/src/test/java/com/intel/jndn/utils/SegmentedClientTest.java
@@ -97,6 +97,14 @@
   }
 
   /**
+   * Test that a sync failed request fails with an exception.
+   */
+  @Test(expected = IOException.class)
+  public void testSyncFailureToRetrieve() throws IOException {
+    SegmentedClient.getDefault().getSync(new MockFace(), new Name("/test/no-data"));
+  }
+
+  /**
    * Ensure Name of the returned Data is the same as was requested; identifies
    * bug where the last Name.Component was always cut off.
    *
@@ -115,4 +123,5 @@
     assertEquals(name.toUri(), future.getName().toUri());
     assertEquals(name.toUri(), future.get().getName().toUri());
   }
+
 }
diff --git a/src/test/java/com/intel/jndn/utils/SegmentedServerTest.java b/src/test/java/com/intel/jndn/utils/SegmentedServerTest.java
new file mode 100644
index 0000000..a840cd0
--- /dev/null
+++ b/src/test/java/com/intel/jndn/utils/SegmentedServerTest.java
@@ -0,0 +1,60 @@
+/*
+ * jndn-utils
+ * Copyright (c) 2015, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU Lesser General Public License,
+ * version 3, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
+ * more details.
+ */
+package com.intel.jndn.utils;
+
+import com.intel.jndn.mock.MockFace;
+import java.io.IOException;
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Name;
+import net.named_data.jndn.util.Blob;
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+/**
+ *
+ * @author Andrew Brown <andrew.brown@intel.com>
+ */
+public class SegmentedServerTest {
+
+  MockFace face = new MockFace();
+  SegmentedServer instance = new SegmentedServer(face, new Name("/test/prefix"));
+
+  @Test
+  public void testGetPrefix() {
+    assertNotNull(instance.getPrefix());
+  }
+
+  @Test
+  public void testAddPipelineStage() {
+    instance.addPipelineStage(null);
+  }
+
+  @Test
+  public void testProcessPipeline() throws Exception {
+    Data in = new Data(new Name("/test"));
+    Data out = instance.processPipeline(in);
+    assertEquals(out, in);
+  }
+
+  @Test
+  public void testServe() throws IOException {
+    Data in = new Data(new Name("/test/prefix/serve"));
+    in.setContent(new Blob("1234"));
+    instance.serve(in);
+    Data out = SegmentedClient.getDefault().getSync(face, new Name("/test/prefix/serve"));
+    assertEquals(in.getContent(), out.getContent());
+    assertEquals(in.getName().toUri(), out.getName().toUri());
+    assertEquals("1234", out.getContent().toString());
+  }
+}
diff --git a/src/test/java/com/intel/jndn/utils/SimpleClientTest.java b/src/test/java/com/intel/jndn/utils/SimpleClientTest.java
index 0386db1..9a94066 100644
--- a/src/test/java/com/intel/jndn/utils/SimpleClientTest.java
+++ b/src/test/java/com/intel/jndn/utils/SimpleClientTest.java
@@ -16,6 +16,7 @@
 import org.junit.Test;
 import static org.junit.Assert.*;
 import com.intel.jndn.mock.MockTransport;
+import com.intel.jndn.utils.client.FutureData;
 import java.io.IOException;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
@@ -106,4 +107,22 @@
     // expect an exception
     futureData.get(50, TimeUnit.MILLISECONDS);
   }
+
+  /**
+   * Test that a sync failed request fails with an exception.
+   */
+  @Test(expected = ExecutionException.class)
+  public void testAsyncFailureToRetrieve() throws InterruptedException, ExecutionException {
+    Future future = SimpleClient.getDefault().getAsync(new Face(), new Name("/test/no-data"));
+    assertTrue(future.isDone());
+    future.get();
+  }
+
+  /**
+   * Test that a sync failed request fails with an exception.
+   */
+  @Test(expected = IOException.class)
+  public void testSyncFailureToRetrieve() throws IOException {
+    SimpleClient.getDefault().getSync(new Face(), new Name("/test/no-data"));
+  }
 }
diff --git a/src/test/java/com/intel/jndn/utils/SimpleServerTest.java b/src/test/java/com/intel/jndn/utils/SimpleServerTest.java
new file mode 100644
index 0000000..6910059
--- /dev/null
+++ b/src/test/java/com/intel/jndn/utils/SimpleServerTest.java
@@ -0,0 +1,96 @@
+/*
+ * jndn-utils
+ * Copyright (c) 2015, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU Lesser General Public License,
+ * version 3, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
+ * more details.
+ */
+package com.intel.jndn.utils;
+
+import com.intel.jndn.utils.server.RespondWithData;
+import com.intel.jndn.mock.MockFace;
+import com.intel.jndn.utils.server.RespondWithBlob;
+import java.io.IOException;
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Interest;
+import net.named_data.jndn.Name;
+import net.named_data.jndn.OnData;
+import net.named_data.jndn.encoding.EncodingException;
+import net.named_data.jndn.util.Blob;
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+/**
+ * Test {@link SimpleServer}
+ *
+ * @author Andrew Brown <andrew.brown@intel.com>
+ */
+public class SimpleServerTest {
+
+  MockFace face = new MockFace();
+  SimpleServer instance = new SimpleServer(face, new Name("/test/prefix"));
+
+  @Test
+  public void testGetPrefix() {
+    assertNotNull(instance.getPrefix());
+  }
+
+  @Test
+  public void testAddPipelineStage() {
+    instance.addPipelineStage(null);
+  }
+
+  @Test
+  public void testProcessPipeline() throws Exception {
+    Data in = new Data(new Name("/test"));
+    Data out = instance.processPipeline(in);
+    assertEquals(out, in);
+  }
+
+  @Test
+  public void testRespond() throws IOException, EncodingException {
+    instance.respondUsing(new RespondWithData() {
+      @Override
+      public Data onInterest(Name prefix, Interest interest) throws Exception {
+        Data data = new Data(interest.getName());
+        data.setContent(new Blob("..."));
+        return data;
+      }
+    });
+
+    sendAndCheckOneInterest(new Name("/test/prefix/response"));
+  }
+
+  @Test
+  public void testRespondFromBlob() throws IOException, EncodingException {
+    instance.respondUsing(new RespondWithBlob() {
+      @Override
+      public Blob onInterest(Name prefix, Interest interest) throws Exception {
+        return new Blob("...");
+      }
+    });
+
+    sendAndCheckOneInterest(new Name("/test/prefix/response"));
+  }
+
+  private void sendAndCheckOneInterest(Name interestName) throws EncodingException, IOException {
+    Interest interest = new Interest(interestName);
+    face.getTransport().clear();
+    face.expressInterest(interest, new OnData() {
+      @Override
+      public void onData(Interest interest, Data data) {
+        assertEquals("/test/prefix/response", data.getName().toUri());
+      }
+    });
+
+    face.processEvents();
+    assertEquals(1, face.getTransport().getSentDataPackets().size());
+    assertEquals("...", face.getTransport().getSentDataPackets().get(0).getContent().toString());
+  }
+}
diff --git a/src/test/java/com/intel/jndn/utils/client/FutureDataTest.java b/src/test/java/com/intel/jndn/utils/client/FutureDataTest.java
new file mode 100644
index 0000000..e632cae
--- /dev/null
+++ b/src/test/java/com/intel/jndn/utils/client/FutureDataTest.java
@@ -0,0 +1,98 @@
+/*
+ * jndn-utils
+ * Copyright (c) 2015, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU Lesser General Public License,
+ * version 3, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
+ * more details.
+ */
+package com.intel.jndn.utils.client;
+
+import com.intel.jndn.mock.MockFace;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Name;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * Test {@link FutureData}
+ * @author Andrew Brown <andrew.brown@intel.com>
+ */
+public class FutureDataTest {
+  
+  FutureData instance;
+  
+  public FutureDataTest(){
+    instance = new FutureData(new MockFace(), new Name("/test/future"));
+  }
+
+  /**
+   * Test of getName method, of class FutureData.
+   */
+  @Test
+  public void testGetName() {
+    assertNotNull(instance.getName());
+  }
+
+  /**
+   * Test of cancel method, of class FutureData.
+   */
+  @Test(expected = InterruptedException.class)
+  public void testCancellation() throws InterruptedException, ExecutionException {
+    instance.cancel(true);
+    assertTrue(instance.isCancelled());
+    instance.get();
+  }
+
+  /**
+   * Test of isDone method, of class FutureData.
+   */
+  @Test
+  public void testIsDone() {
+    assertFalse(instance.isDone());
+  }
+
+  /**
+   * Test of resolve method, of class FutureData.
+   */
+  @Test
+  public void testResolve() {
+    instance.resolve(new Data());
+    assertTrue(instance.isDone());
+  }
+
+  /**
+   * Test of reject method, of class FutureData.
+   */
+  @Test
+  public void testReject() {
+    instance.reject(new Error());
+    assertTrue(instance.isDone());
+  }
+
+  /**
+   * Test of get method, of class FutureData.
+   */
+  @Test
+  public void testGet_0args() throws Exception {
+    instance.resolve(new Data(new Name("/test/packet")));
+    Data result = instance.get();
+    assertEquals("/test/packet", result.getName().toUri());
+  }
+
+  /**
+   * Test of get method, of class FutureData.
+   */
+  @Test(expected = TimeoutException.class)
+  public void testGet_long_TimeUnit() throws Exception {
+    instance.get(10, TimeUnit.MILLISECONDS);
+  }
+}
diff --git a/src/test/java/com/intel/jndn/utils/client/SegmentedFutureDataTest.java b/src/test/java/com/intel/jndn/utils/client/SegmentedFutureDataTest.java
new file mode 100644
index 0000000..5bc3149
--- /dev/null
+++ b/src/test/java/com/intel/jndn/utils/client/SegmentedFutureDataTest.java
@@ -0,0 +1,76 @@
+/*
+ * jndn-utils
+ * Copyright (c) 2015, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU Lesser General Public License,
+ * version 3, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
+ * more details.
+ */
+package com.intel.jndn.utils.client;
+
+import com.intel.jndn.mock.MockFace;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Face;
+import net.named_data.jndn.Name;
+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 SegmentedFutureDataTest {
+
+  SegmentedFutureData instance;
+
+  public SegmentedFutureDataTest() {
+    Face face = new MockFace();
+    List<Future<Data>> segments = new ArrayList<>();
+    for (int i = 0; i < 10; i++) {
+      Data data = new Data(new Name("/test/packet").appendSegment(i));
+      data.setContent(new Blob("."));
+      FutureData future = new FutureData(face, data.getName());
+      future.resolve(data);
+      segments.add(future);
+    }
+    instance = new SegmentedFutureData(new Name("/test/packet"), segments);
+  }
+
+  @Test
+  public void testIsDone() {
+    assertTrue(instance.isDone());
+  }
+  
+  @Test
+  public void testIsDoneWhenCancelled() {
+    instance.cancel(false);
+    assertTrue(instance.isDone());
+  }
+
+  /**
+   * Test of get method, of class SegmentedFutureData.
+   */
+  @Test
+  public void testGet_0args() throws Exception {
+    assertEquals(10, instance.get().getContent().size());
+  }
+
+  /**
+   * Test of get method, of class FutureData.
+   */
+  @Test
+  public void testGet_long_TimeUnit() throws Exception {
+    instance.get(10, TimeUnit.MILLISECONDS);
+  }
+}
diff --git a/src/test/java/com/intel/jndn/utils/server/ServerBaseImplTest.java b/src/test/java/com/intel/jndn/utils/server/ServerBaseImplTest.java
new file mode 100644
index 0000000..41cdf3c
--- /dev/null
+++ b/src/test/java/com/intel/jndn/utils/server/ServerBaseImplTest.java
@@ -0,0 +1,94 @@
+/*
+ * jndn-utils
+ * Copyright (c) 2015, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU Lesser General Public License,
+ * version 3, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
+ * more details.
+ */
+package com.intel.jndn.utils.server;
+
+import com.intel.jndn.mock.MockFace;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Face;
+import net.named_data.jndn.Interest;
+import net.named_data.jndn.Name;
+import net.named_data.jndn.transport.Transport;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * Test base server implementation.
+ *
+ * @author Andrew Brown <andrew.brown@intel.com>
+ */
+public class ServerBaseImplTest {
+
+  Face face = new MockFace();
+  ServerBaseImpl instance = new ServerBaseImplImpl(face, new Name("/test/base"));
+
+  public class ServerBaseImplImpl extends ServerBaseImpl {
+
+    public ServerBaseImplImpl(Face face, Name prefix) {
+      super(face, prefix);
+    }
+
+    @Override
+    public void onInterest(Name prefix, Interest interest, Transport transport, long registeredPrefixId) {
+      throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+    }
+  }
+
+  /**
+   * Test of getPrefix method, of class ServerBaseImpl.
+   */
+  @Test
+  public void testGetPrefix() {
+    assertNotNull(instance.getPrefix());
+  }
+
+  /**
+   * Test of register method, of class ServerBaseImpl.
+   */
+  @Test
+  public void testRegister() throws Exception {
+    assertFalse(instance.isRegistered());
+    instance.register();
+    assertTrue(instance.isRegistered());
+  }
+
+  /**
+   * Test of addPipelineStage method, of class ServerBaseImpl.
+   */
+  @Test(expected = Exception.class)
+  public void testPipeline() throws Exception {
+    PipelineStage<Data, Data> pipelineStage = new PipelineStage<Data, Data>() {
+      @Override
+      public Data process(Data context) throws Exception {
+        throw new Exception("Test exceptions with this");
+      }
+    };
+    instance.addPipelineStage(pipelineStage);
+    instance.processPipeline(new Data());
+  }
+
+  /**
+   * Test of run method, of class ServerBaseImpl.
+   */
+  @Test
+  public void testRun() throws InterruptedException {
+    assertFalse(instance.isRegistered());
+    ExecutorService executor = Executors.newSingleThreadExecutor();
+    executor.submit(instance);
+    Thread.sleep(100);
+    assertTrue(instance.isRegistered());
+    executor.shutdownNow();
+  }
+}
