diff --git a/src/test/java/com/intel/jndn/utils/SegmentedClientTest.java b/src/test/java/com/intel/jndn/utils/SegmentedClientTest.java
index 823223d..2ee0ae4 100644
--- a/src/test/java/com/intel/jndn/utils/SegmentedClientTest.java
+++ b/src/test/java/com/intel/jndn/utils/SegmentedClientTest.java
@@ -14,19 +14,17 @@
 package com.intel.jndn.utils;
 
 import com.intel.jndn.mock.MockFace;
-import com.intel.jndn.utils.client.SegmentedFutureData;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
-import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.logging.Logger;
 import net.named_data.jndn.Data;
+import net.named_data.jndn.Face;
 import net.named_data.jndn.Interest;
+import net.named_data.jndn.InterestFilter;
 import net.named_data.jndn.Name;
 import net.named_data.jndn.Name.Component;
-import net.named_data.jndn.OnInterest;
-import net.named_data.jndn.transport.Transport;
+import net.named_data.jndn.OnInterestCallback;
 import net.named_data.jndn.util.Blob;
 import org.junit.Test;
 import static org.junit.Assert.*;
@@ -40,26 +38,26 @@
 public class SegmentedClientTest {
 
   private static final Logger logger = Logger.getLogger(SimpleClient.class.getName());
+  private SegmentedClient instance;
   private MockFace face;
 
   @Before
   public void beforeTest() {
     face = new MockFace();
+    instance = new SegmentedClient(1, 100); // warning: setting an interest 
+    // lifetime that is too low will cause the getSync() tests to fail due to
+    // Thread.sleep()
   }
 
-  /**
-   * Test of getSync method, of class SegmentedClient.
-   *
-   * @throws java.lang.Exception
-   */
   @Test
   public void testGetSync() throws Exception {
-    face.registerPrefix(new Name("/segmented/data"), new OnInterest() {
+    Name name = new Name("/segmented/data");
+    face.registerPrefix(name, new OnInterestCallback() {
       private int count = 0;
       private int max = 9;
 
       @Override
-      public void onInterest(Name prefix, Interest interest, Transport transport, long registeredPrefixId) {
+      public void onInterest(Name prefix, Interest interest, Face face, long interestFilterId, InterestFilter filter) {
         Data data = new Data(interest.getName());
         if (!SegmentedClient.hasSegment(data.getName())) {
           data.getName().appendSegment(0);
@@ -67,14 +65,15 @@
         data.getMetaInfo().setFinalBlockId(Component.fromNumberWithMarker(max, 0x00));
         data.setContent(new Blob("."));
         try {
-          transport.send(data.wireEncode().buf());
+          face.putData(data);
         } catch (IOException e) {
           fail(e.getMessage());
         }
       }
     }, null);
 
-    Data data = SegmentedClient.getDefault().getSync(face, new Name("/segmented/data").appendSegment(0));
+    logger.info("Client retrieving segments synchronously: " + name.toUri());
+    Data data = instance.getSync(face, new Name(name).appendSegment(0));
     assertEquals(10, data.getContent().size());
   }
 
@@ -83,40 +82,23 @@
    *
    * @throws java.lang.Exception
    */
-  @Test(expected = ExecutionException.class)
-  public void testFailureToRetrieve() throws Exception {
-    // retrieve non-existent data, should timeout
-    logger.info("Client expressing interest asynchronously: /test/no-data");
-    Future<Data> futureData = SegmentedClient.getDefault().getAsync(face, new Name("/test/no-data"));
-    futureData.get();
-  }
+//  @Test(expected = ExecutionException.class)
+//  public void testFailureToRetrieve() throws Exception {
+//    // retrieve non-existent data, should timeout
+//    logger.info("Client retrieving segments asynchronously: /test/no-data");
+//    Future<Data> futureData = instance.getAsync(face, new Name("/test/no-data"));
+//    face.processEvents();
+//    futureData.get();
+//  }
 
-  /**
-   * Test that a sync failed request fails with an exception.
-   */
-  @Test(expected = IOException.class)
-  public void testSyncFailureToRetrieve() throws IOException {
-    SegmentedClient.getDefault().getSync(face, new Name("/test/no-data"));
-  }
-
-  /**
-   * Identifies bug where the last Name.Component was always cut off.
-   *
-   * @throws InterruptedException
-   * @throws ExecutionException
-   */
-  @Test
-  public void testNameShorteningLogic() throws InterruptedException, ExecutionException {
-    final List<Data> segments = buildSegmentedData("/test/name", 10);
-    for (Data segment : segments) {
-      face.addResponse(segment.getName(), segment);
-    }
-
-    Name name = new Name("/test/name").appendSegment(0);
-
-    SegmentedFutureData future = (SegmentedFutureData) SegmentedClient.getDefault().getAsync(face, name);
-    assertEquals(name.getPrefix(-1).toUri(), future.get().getName().toUri());
-  }
+//  /**
+//   * Test that a sync failed request fails with an exception.
+//   */
+//  @Test(expected = IOException.class)
+//  public void testSyncFailureToRetrieve() throws IOException {
+//    logger.info("Client retrieving segments synchronously: /test/no-data");
+//    instance.getSync(face, new Name("/test/no-data"));
+//  }
 
   /**
    * Verify that Data returned with a different Name than the Interest is still
@@ -126,7 +108,7 @@
    */
   @Test
   public void testWhenDataNameIsLongerThanInterestName() throws Exception {
-    final List<Data> segments = buildSegmentedData("/a/b/c/d", 10);
+    final List<Data> segments = TestHelper.buildSegments(new Name("/a/b/c/d"), 0, 10);
     for (Data segment : segments) {
       face.addResponse(segment.getName(), segment);
     }
@@ -134,7 +116,8 @@
     Name name = new Name("/a/b");
     face.addResponse(name, segments.get(0));
 
-    Data data = SegmentedClient.getDefault().getSync(face, name);
+    logger.info("Client retrieving segments synchronously: " + name.toUri());
+    Data data = instance.getSync(face, name);
     assertNotNull(data);
     assertEquals("/a/b/c/d", data.getName().toUri());
   }
@@ -148,10 +131,12 @@
   @Test
   public void testNoContent() throws Exception {
     Name name = new Name("/test/no-content").appendSegment(0);
-    Data data = buildSegmentedData(name);
+    Data data = TestHelper.buildData(name, "", 0);
     face.addResponse(name, data);
 
-    Future<Data> result = SegmentedClient.getDefault().getAsync(face, name);
+    logger.info("Client retrieving segments asynchronously: /test/no-content");
+    Future<Data> result = instance.getAsync(face, name);
+    face.processEvents();
     assertEquals("/test/no-content", result.get().getName().toUri());
     assertEquals("", result.get().getContent().toString());
   }
@@ -174,7 +159,10 @@
     data1.getMetaInfo().setFinalBlockId(Name.Component.fromNumberWithMarker(1, 0x00));
     face.addResponse(data2.getName(), data2);
 
-    Future<Data> result = SegmentedClient.getDefault().getAsync(face, new Name("/test/content-length").appendSegment(0));
+    logger.info("Client retrieving segments asynchronously: /test/content-length");
+    Future<Data> result = instance.getAsync(face, new Name("/test/content-length").appendSegment(0));
+    face.processEvents();
+    face.processEvents();
     assertEquals(20, result.get().getContent().size());
   }
 
@@ -191,35 +179,10 @@
     data.setContent(new Blob("1"));
     face.addResponse(name, data);
 
-    Future<Data> result = SegmentedClient.getDefault().getAsync(face, name);
+    logger.info("Client retrieving segments asynchronously: /test/no-final-block-id");
+    Future<Data> result = instance.getAsync(face, name);
+    face.processEvents();
     assertEquals("/test/no-final-block-id", result.get().getName().toUri());
     assertEquals("1", result.get().getContent().toString());
   }
-
-  /**
-   * Helper method, sets FinalBlockId from last Name component
-   *
-   * @param name
-   * @return
-   */
-  private Data buildSegmentedData(Name name) {
-    Data data = new Data(name);
-    data.getMetaInfo().setFinalBlockId(name.get(-1));
-    return data;
-  }
-
-  private List<Data> buildSegmentedData(String name, int numSegments) {
-    Name.Component finalBlockId = Name.Component.fromNumberWithMarker(numSegments - 1, 0x00);
-    List<Data> segments = new ArrayList<>(numSegments);
-
-    for (int i = 0; i < numSegments; i++) {
-      Data data = new Data(new Name(name).appendSegment(i));
-      data.setContent(new Blob("0123456789"));
-      data.getMetaInfo().setFinalBlockId(finalBlockId);
-      segments.add(data);
-    }
-
-    return segments;
-  }
-
 }
diff --git a/src/test/java/com/intel/jndn/utils/SimpleClientTest.java b/src/test/java/com/intel/jndn/utils/SimpleClientTest.java
index 3cae974..35883a9 100644
--- a/src/test/java/com/intel/jndn/utils/SimpleClientTest.java
+++ b/src/test/java/com/intel/jndn/utils/SimpleClientTest.java
@@ -13,11 +13,12 @@
  */
 package com.intel.jndn.utils;
 
+import com.intel.jndn.mock.MockFace;
 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.CompletableFuture;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
@@ -25,12 +26,14 @@
 import java.util.logging.Logger;
 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.encoding.EncodingException;
 import net.named_data.jndn.util.Blob;
 import org.junit.rules.ExpectedException;
 
 /**
- * Test Client.java
+ * Test SimpleClient.java
  *
  * @author Andrew Brown <andrew.brown@intel.com>
  */
@@ -39,11 +42,6 @@
   private static final Logger logger = Logger.getLogger(SimpleClient.class.getName());
   public ExpectedException thrown = ExpectedException.none();
 
-  /**
-   * Test retrieving data synchronously
-   *
-   * @throws java.io.IOException
-   */
   @Test
   public void testGetSync() throws IOException {
     // setup face
@@ -62,13 +60,8 @@
     assertEquals(new Blob("...").buf(), data.getContent().buf());
   }
 
-  /**
-   * Test retrieving data asynchronously
-   *
-   * @throws InterruptedException
-   */
   @Test
-  public void testGetAsync() throws InterruptedException, ExecutionException {
+  public void testGetAsync() throws InterruptedException, ExecutionException, IOException, EncodingException {
     // setup face
     MockTransport transport = new MockTransport();
     Face face = new Face(transport, null);
@@ -82,47 +75,56 @@
     logger.info("Client expressing interest asynchronously: /test/async");
     SimpleClient client = new SimpleClient();
     Future<Data> futureData = client.getAsync(face, new Name("/test/async"));
-
     assertTrue(!futureData.isDone());
-    futureData.get();
+    
+    // process events to retrieve data
+    face.processEvents();
     assertTrue(futureData.isDone());
     assertEquals(new Blob("...").toString(), futureData.get().getContent().toString());
   }
 
-  /**
-   * Test that asynchronous client times out correctly
-   *
-   * @throws InterruptedException
-   */
-  @Test(expected = TimeoutException.class)
-  public void testTimeout() throws InterruptedException, ExecutionException, TimeoutException {
+  @Test
+  public void testTimeout() throws Exception {
     // setup face
     MockTransport transport = new MockTransport();
     Face face = new Face(transport, null);
 
     // retrieve non-existent data, should timeout
     logger.info("Client expressing interest asynchronously: /test/timeout");
-    Future<Data> futureData = SimpleClient.getDefault().getAsync(face, new Name("/test/timeout"));
+    Interest interest = new Interest(new Name("/test/timeout"), 1);
+    CompletableFuture<Data> futureData = SimpleClient.getDefault().getAsync(face, interest);
 
-    // expect an exception
-    futureData.get(50, TimeUnit.MILLISECONDS);
+    // wait for NDN timeout
+    Thread.sleep(2);
+    face.processEvents();
+    
+    // verify that the client is completing the future with a TimeoutException
+    assertTrue(futureData.isDone());
+    assertTrue(futureData.isCompletedExceptionally());
+    try{
+      futureData.get();
+    }
+    catch(ExecutionException e){
+      assertTrue(e.getCause() instanceof TimeoutException);
+    }
   }
 
-  /**
-   * 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"));
-    future.get();
-    assertTrue(future.isDone());
+  @Test(expected = Exception.class)
+  public void testAsyncFailureToRetrieve() throws Exception {
+    Face face = new MockFace();
+    
+    logger.info("Client expressing interest asynchronously: /test/no-data");
+    Interest interest = new Interest(new Name("/test/no-data"), 10);
+    Future future = SimpleClient.getDefault().getAsync(face, interest);
+    
+    face.processEvents();
+    future.get(15, TimeUnit.MILLISECONDS);
   }
 
-  /**
-   * 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"));
+    logger.info("Client expressing interest synchronously: /test/no-data");
+    Interest interest = new Interest(new Name("/test/no-data"), 10);
+    SimpleClient.getDefault().getSync(new Face(), interest);
   }
 }
diff --git a/src/test/java/com/intel/jndn/utils/SimpleClientTestIT.java b/src/test/java/com/intel/jndn/utils/SimpleClientTestIT.java
new file mode 100644
index 0000000..b60eed8
--- /dev/null
+++ b/src/test/java/com/intel/jndn/utils/SimpleClientTestIT.java
@@ -0,0 +1,103 @@
+/*
+ * 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.MockKeyChain;
+import java.io.IOException;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Face;
+import net.named_data.jndn.Interest;
+import net.named_data.jndn.InterestFilter;
+import net.named_data.jndn.Name;
+import net.named_data.jndn.OnInterestCallback;
+import net.named_data.jndn.encoding.EncodingException;
+import net.named_data.jndn.security.KeyChain;
+import net.named_data.jndn.security.SecurityException;
+import net.named_data.jndn.util.Blob;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test SimpleClient.java; requires a hostname to an NFD accepting a generated
+ * key to register prefixes, e.g. mvn test -Dnfd.ip=10.10.10.1
+ *
+ * @author Andrew Brown <andrew.brown@intel.com>
+ */
+public class SimpleClientTestIT {
+
+  private static final Logger logger = Logger.getLogger(SegmentedServerTestIT.class.getName());
+  private static final Name PREFIX = new Name("/test/for/simple-client");
+
+  Face face;
+  SimpleClient instance;
+  String ip;
+  ScheduledExecutorService pool;
+
+  public SimpleClientTestIT() throws SecurityException {
+    this.ip = System.getProperty("nfd.ip");
+    this.face = new Face(ip);
+    this.instance = SimpleClient.getDefault();
+    this.pool = Executors.newScheduledThreadPool(2);
+
+    KeyChain mockKeyChain = MockKeyChain.configure(new Name("/test/server"));
+    face.setCommandSigningInfo(mockKeyChain, mockKeyChain.getDefaultCertificateName());
+    pool.scheduleAtFixedRate(new EventProcessor(face), 0, 10, TimeUnit.MILLISECONDS);
+  }
+
+  @Test
+  public void testCompletableFuture() throws Exception {
+    Data servedData = new Data();
+    servedData.setContent(new Blob("....."));
+    face.registerPrefix(PREFIX, new OnInterestCallback() {
+      @Override
+      public void onInterest(Name prefix, Interest interest, Face face, long interestFilterId, InterestFilter filter) {
+        servedData.setName(interest.getName());
+        try {
+          face.putData(servedData);
+        } catch (IOException ex) {
+          logger.log(Level.SEVERE, "Failed to put data.", ex);
+        }
+      }
+    }, null);
+
+    CompletableFuture<Data> future = instance.getAsync(face, PREFIX);
+    Data retrievedData = future.get(200, TimeUnit.MILLISECONDS);
+
+    Assert.assertEquals(servedData.getContent().toString(), retrievedData.getContent().toString());
+  }
+
+  private class EventProcessor implements Runnable {
+
+    private final Face face;
+
+    public EventProcessor(Face face) {
+      this.face = face;
+    }
+
+    @Override
+    public void run() {
+      try {
+        face.processEvents();
+      } catch (IOException | EncodingException ex) {
+        logger.log(Level.SEVERE, null, ex);
+      }
+    }
+  }
+}
diff --git a/src/test/java/com/intel/jndn/utils/TestHelper.java b/src/test/java/com/intel/jndn/utils/TestHelper.java
new file mode 100644
index 0000000..8784a8d
--- /dev/null
+++ b/src/test/java/com/intel/jndn/utils/TestHelper.java
@@ -0,0 +1,54 @@
+/*
+ * 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 java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Name;
+import net.named_data.jndn.util.Blob;
+
+/**
+ *
+ * @author Andrew Brown <andrew.brown@intel.com>
+ */
+public class TestHelper {
+  
+  public static List<CompletableFuture<Data>> buildFutureSegments(Name name, int from, int to) {
+    return buildSegments(name, from, to).stream()
+            .map((d) -> CompletableFuture.completedFuture(d))
+            .collect(Collectors.toList());
+  }
+
+  public static List<Data> buildSegments(Name name, int from, int to) {
+    return IntStream.range(0, 10).boxed()
+            .map((i) -> buildData(new Name(name).appendSegment(i), i.toString(), to - 1))
+            .collect(Collectors.toList());
+  }
+
+  public static Data buildData(Name name, String content) {
+    Data data = new Data(name);
+    data.setContent(new Blob(content));
+
+    return data;
+  }
+  
+  public static Data buildData(Name name, String content, int finalBlockId){
+    Data data = buildData(name, content);
+    data.getMetaInfo().setFinalBlockId(Name.Component.fromNumberWithMarker(finalBlockId, 0x00));
+    return data;
+  }
+}
diff --git a/src/test/java/com/intel/jndn/utils/client/FutureDataTest.java b/src/test/java/com/intel/jndn/utils/client/FutureDataTest.java
deleted file mode 100644
index e632cae..0000000
--- a/src/test/java/com/intel/jndn/utils/client/FutureDataTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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/SegmentedDataReassemblerTest.java b/src/test/java/com/intel/jndn/utils/client/SegmentedDataReassemblerTest.java
new file mode 100644
index 0000000..881b6af
--- /dev/null
+++ b/src/test/java/com/intel/jndn/utils/client/SegmentedDataReassemblerTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.utils.TestHelper;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Name;
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+/**
+ * Test that segment data packets are re-assembled correctly.
+ *
+ * @author Andrew Brown <andrew.brown@intel.com>
+ */
+public class SegmentedDataReassemblerTest {
+
+  @Test
+  public void testReassemble() throws InterruptedException, ExecutionException {
+    Name name = new Name("/data/re-assembly");
+    List<CompletableFuture<Data>> segments = TestHelper.buildFutureSegments(name, 0, 10);
+    SegmentedDataReassembler instance = new SegmentedDataReassembler(name, segments);
+
+    CompletableFuture<Data> future = instance.reassemble();
+    assertTrue(future.isDone());
+    assertEquals(name.toUri(), future.get().getName().toUri()); // tests name-shortening logic
+    assertEquals("0123456789", future.get().getContent().toString());
+  }
+}
diff --git a/src/test/java/com/intel/jndn/utils/client/SegmentedFutureDataTest.java b/src/test/java/com/intel/jndn/utils/client/SegmentedFutureDataTest.java
deleted file mode 100644
index e030083..0000000
--- a/src/test/java/com/intel/jndn/utils/client/SegmentedFutureDataTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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();
-    instance = new SegmentedFutureData(face, new Name("/test/packet"));
-    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);
-      instance.add(future);
-    }
-  }
-
-  @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(expected = TimeoutException.class)
-  public void testGet_long_TimeUnit() throws Exception {
-    Face face = new MockFace();
-    Data data = new Data(new Name("/test/packet").appendSegment(0));
-    FutureData future = new FutureData(face, data.getName());
-    
-    SegmentedFutureData segmentedFuture = new SegmentedFutureData(face, new Name("/test/packet"));
-    segmentedFuture.add(future);
-    
-    segmentedFuture.get(10, TimeUnit.MILLISECONDS);
-  }
-}
