Segmentation tweaks and further tests
diff --git a/src/main/java/com/intel/jndn/utils/client/SegmentedFutureData.java b/src/main/java/com/intel/jndn/utils/client/SegmentedFutureData.java
index 66d01be..252f72c 100644
--- a/src/main/java/com/intel/jndn/utils/client/SegmentedFutureData.java
+++ b/src/main/java/com/intel/jndn/utils/client/SegmentedFutureData.java
@@ -143,7 +143,7 @@
     ByteArrayOutputStream content = new ByteArrayOutputStream();
     for (Future<Data> futureData : segments) {
       try {
-        content.write(futureData.get().getContent().getImmutableArray());
+        content.write(futureData.get(timeout, unit).getContent().getImmutableArray());
       } catch (ExecutionException | IOException | InterruptedException e) {
         throw new ExecutionException("Failed while aggregating retrieved packets: " + interestName.toUri(), e);
       }
diff --git a/src/main/java/com/intel/jndn/utils/repository/ForLoopRepository.java b/src/main/java/com/intel/jndn/utils/repository/ForLoopRepository.java
index 8f8ed5b..80fedb1 100644
--- a/src/main/java/com/intel/jndn/utils/repository/ForLoopRepository.java
+++ b/src/main/java/com/intel/jndn/utils/repository/ForLoopRepository.java
@@ -50,7 +50,6 @@
       if (interest.matchesName(record.data.getName())) {
         if (hasNoChildSelector(interest) && hasAcceptableFreshness(interest, record)) {
           selectedData = record.data;
-          break;
         } else {
           Name.Component component = getNextComponentAfterLastInterestComponent(record.data, interest);
 
@@ -119,7 +118,7 @@
    */
   private boolean isFresh(Record record) {
     double period = record.data.getMetaInfo().getFreshnessPeriod();
-    return period < 0 || record.addedAt + period > System.currentTimeMillis();
+    return period < 0 || record.addedAt + (long) period > System.currentTimeMillis();
   }
 
   /**
diff --git a/src/test/java/com/intel/jndn/utils/SegmentedServerTestIT.java b/src/test/java/com/intel/jndn/utils/SegmentedServerTestIT.java
index 3b78b74..49d054f 100644
--- a/src/test/java/com/intel/jndn/utils/SegmentedServerTestIT.java
+++ b/src/test/java/com/intel/jndn/utils/SegmentedServerTestIT.java
@@ -15,10 +15,10 @@
 
 import com.intel.jndn.mock.MockKeyChain;
 import java.io.IOException;
-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.Name;
 import net.named_data.jndn.encoding.EncodingException;
 import net.named_data.jndn.security.KeyChain;
@@ -52,22 +52,19 @@
 
   @Test
   public void testRegisterAndRetrieval() throws Exception {
-    final Name name = new Name(prefix).append("1");
+    final Name name1 = new Name(prefix).append("1");
+    final Name name2 = new Name(prefix).append("2");
 
     // why a new thread? The server will only operate if someone turns the crank,
     // i.e. someone calls face.processEvents() every so often. 
     new Thread(new Runnable() {
       @Override
       public void run() {
-        Data served = new Data(name);
-        served.setContent(new Blob("..."));
-        served.getMetaInfo().setFreshnessPeriod(30000);
-
         try {
-          instance.serve(served);
-          logger.info("Serving data: " + name.toUri());
+          instance.serve(buildDataPacket(name1));
+          instance.serve(buildDataPacket(name2));
         } catch (IOException ex) {
-          logger.info("Failed to serve data: " + name.toUri());
+          logger.info("Failed to serve data.");
         }
 
         while (true) {
@@ -86,9 +83,22 @@
 
     // why a different face? because we don't want the abover face.processEvents()
     // to interfere with the SimpleClient's processEvents().
-    logger.info("Retrieving data: " + name.toUri());
-    Data retrieved = SegmentedClient.getDefault().getSync(new Face(ip), name);
+    logger.info("Retrieving data: " + prefix.toUri());
+    Interest interest = new Interest(new Name(prefix));
+    interest.setInterestLifetimeMilliseconds(2000);
+    interest.setMustBeFresh(true);
+    interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
+    
+    Data retrieved = SegmentedClient.getDefault().getSync(new Face(ip), interest);
     assertNotNull(retrieved);
     assertEquals("...", retrieved.getContent().toString());
+    logger.info("Retrieved data: " + retrieved.getName().toUri());
+  }
+
+  Data buildDataPacket(Name name) {
+    Data data = new Data(new Name(name).appendSegment(0));
+    data.setContent(new Blob("..."));
+    data.getMetaInfo().setFreshnessPeriod(30000);
+    return data;
   }
 }
diff --git a/src/test/java/com/intel/jndn/utils/client/SegmentedFutureDataTest.java b/src/test/java/com/intel/jndn/utils/client/SegmentedFutureDataTest.java
index 5bc3149..b97104d 100644
--- a/src/test/java/com/intel/jndn/utils/client/SegmentedFutureDataTest.java
+++ b/src/test/java/com/intel/jndn/utils/client/SegmentedFutureDataTest.java
@@ -69,8 +69,16 @@
   /**
    * Test of get method, of class FutureData.
    */
-  @Test
+  @Test(expected = TimeoutException.class)
   public void testGet_long_TimeUnit() throws Exception {
-    instance.get(10, TimeUnit.MILLISECONDS);
+    Face face = new MockFace();
+    Data data = new Data(new Name("/test/packet").appendSegment(0));
+    FutureData future = new FutureData(face, data.getName());
+    
+    List<Future<Data>> segments = new ArrayList<>();
+    segments.add(future);
+    SegmentedFutureData segmentedFuture = new SegmentedFutureData(new Name("/test/packet"), segments);
+    
+    segmentedFuture.get(10, TimeUnit.MILLISECONDS);
   }
 }