Move all segmentation methods to SegmentationHelper
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/DataAssembler.java b/src/main/java/com/intel/jndn/utils/client/impl/DataAssembler.java
index d06795a..be642fc 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/DataAssembler.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/DataAssembler.java
@@ -1,6 +1,6 @@
 /*
  * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2016, 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,
@@ -13,6 +13,7 @@
  */
 package com.intel.jndn.utils.client.impl;
 
+import com.intel.jndn.utils.impl.SegmentationHelper;
 import net.named_data.jndn.Data;
 import net.named_data.jndn.util.Blob;
 
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/DefaultSegmentedClient.java b/src/main/java/com/intel/jndn/utils/client/impl/DefaultSegmentedClient.java
index 302645c..f3c5412 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/DefaultSegmentedClient.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/DefaultSegmentedClient.java
@@ -1,6 +1,6 @@
 /*
  * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2016, 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,
@@ -15,6 +15,7 @@
 
 import com.intel.jndn.utils.client.DataStream;
 import com.intel.jndn.utils.client.SegmentedClient;
+import com.intel.jndn.utils.impl.SegmentationHelper;
 import net.named_data.jndn.Data;
 import net.named_data.jndn.Face;
 import net.named_data.jndn.Interest;
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/SegmentationHelper.java b/src/main/java/com/intel/jndn/utils/client/impl/SegmentationHelper.java
deleted file mode 100644
index 27d4187..0000000
--- a/src/main/java/com/intel/jndn/utils/client/impl/SegmentationHelper.java
+++ /dev/null
@@ -1,66 +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.impl;
-
-import net.named_data.jndn.Name;
-import net.named_data.jndn.encoding.EncodingException;
-
-/**
- * Helper methods for dealing with segmented packets (see
- * http://named-data.net/doc/tech-memos/naming-conventions.pdf).
- *
- * @author Andrew Brown, andrew.brown@intel.com
- */
-public class SegmentationHelper {
-
-  /**
-   * Determine if a name is segmented, i.e. if it ends with the correct marker
-   * type.
-   *
-   * @param name the name of a packet
-   * @param marker the marker type (the initial byte of the component)
-   * @return true if the name is segmented
-   */
-  public static boolean isSegmented(Name name, byte marker) {
-    return name.size() > 0 && name.get(-1).getValue().buf().get(0) == marker;
-  }
-
-  /**
-   * Retrieve the segment number from the last component of a name.
-   *
-   * @param name the name of a packet
-   * @param marker the marker type (the initial byte of the component)
-   * @return the segment number
-   * @throws EncodingException if the name does not have a final component of
-   * the correct marker type
-   */
-  public static long parseSegment(Name name, byte marker) throws EncodingException {
-    if (name.size() == 0) {
-      throw new EncodingException("No components to parse.");
-    }
-    return name.get(-1).toNumberWithMarker(marker);
-  }
-
-  /**
-   * Remove a segment component from the end of a name
-   *
-   * @param name the name of a packet
-   * @param marker the marker type (the initial byte of the component)
-   * @return the new name with the segment component removed or a copy of the
-   * name if no segment component was present
-   */
-  public static Name removeSegment(Name name, byte marker) {
-    return isSegmented(name, marker) ? name.getPrefix(-1) : new Name(name);
-  }
-}
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/SegmentedDataStream.java b/src/main/java/com/intel/jndn/utils/client/impl/SegmentedDataStream.java
index 2d0f691..61d4da4 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/SegmentedDataStream.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/SegmentedDataStream.java
@@ -1,6 +1,6 @@
 /*
  * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2016, 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,
@@ -16,6 +16,7 @@
 import com.intel.jndn.utils.client.DataStream;
 import com.intel.jndn.utils.client.OnComplete;
 import com.intel.jndn.utils.client.OnException;
+import com.intel.jndn.utils.impl.SegmentationHelper;
 import net.named_data.jndn.Data;
 import net.named_data.jndn.Interest;
 import net.named_data.jndn.Name;
diff --git a/src/main/java/com/intel/jndn/utils/impl/SegmentationHelper.java b/src/main/java/com/intel/jndn/utils/impl/SegmentationHelper.java
new file mode 100644
index 0000000..f63fe2f
--- /dev/null
+++ b/src/main/java/com/intel/jndn/utils/impl/SegmentationHelper.java
@@ -0,0 +1,149 @@
+/*
+ * jndn-utils
+ * Copyright (c) 2016, 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.impl;
+
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Name;
+import net.named_data.jndn.encoding.EncodingException;
+import net.named_data.jndn.util.Blob;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Helper methods for reading and writing segmented NDN packets. See <a
+ * href="http://named-data.net/doc/tech-memos/naming-conventions.pdf">NDN Naming Conventions</a> for information used
+ * in this class
+ * <p>
+ * For segmentation of streams: the current use of the default segment size of 4096
+ * (only for {@link #segment(net.named_data.jndn.Data, java.io.InputStream)} is based on several assumptions: NDN packet
+ * size was limited to 8000 at the time this was written and the signature size is unknown.
+ *
+ * @author Andrew Brown, andrew.brown@intel.com
+ */
+public class SegmentationHelper {
+
+  public static final int DEFAULT_SEGMENT_SIZE = 4096;
+  private static final byte NDN_SEGMENT_MARKER = 0x00;
+
+  private SegmentationHelper() {
+    // do not instantiate this class
+  }
+
+  /**
+   * Determine if a name is segmented, i.e. if it ends with the correct marker type.
+   *
+   * @param name the name of a packet
+   * @param marker the marker type (the initial byte of the component)
+   * @return true if the name is segmented
+   */
+  public static boolean isSegmented(Name name, byte marker) {
+    return name.size() > 0 && name.get(-1).getValue().buf().get(0) == marker;
+  }
+
+  /**
+   * Retrieve the segment number from the last component of a name.
+   *
+   * @param name the name of a packet
+   * @param marker the marker type (the initial byte of the component)
+   * @return the segment number
+   * @throws EncodingException if the name does not have a final component of the correct marker type
+   */
+  public static long parseSegment(Name name, byte marker) throws EncodingException {
+    if (name.size() == 0) {
+      throw new EncodingException("No components to parse.");
+    }
+    return name.get(-1).toNumberWithMarker(marker);
+  }
+
+  /**
+   * Remove a segment component from the end of a name
+   *
+   * @param name the name of a packet
+   * @param marker the marker type (the initial byte of the component)
+   * @return the new name with the segment component removed or a copy of the name if no segment component was present
+   */
+  public static Name removeSegment(Name name, byte marker) {
+    return isSegmented(name, marker) ? name.getPrefix(-1) : new Name(name);
+  }
+
+  /**
+   * Segment a stream of bytes into a list of Data packets; this must read all
+   * the bytes first in order to determine the end segment for FinalBlockId.
+   *
+   * @param template the {@link Data} packet to use for the segment {@link Name}, {@link net.named_data.jndn.MetaInfo},
+   * etc.
+   * @param bytes an {@link InputStream} to the bytes to segment
+   * @return a list of segmented {@link Data} packets
+   * @throws IOException if the stream fails
+   */
+  public static List<Data> segment(Data template, InputStream bytes) throws IOException {
+    return segment(template, bytes, DEFAULT_SEGMENT_SIZE);
+  }
+
+  /**
+   * Segment a stream of bytes into a list of Data packets; this must read all
+   * the bytes first in order to determine the end segment for FinalBlockId.
+   *
+   * @param template the {@link Data} packet to use for the segment {@link Name}, {@link net.named_data.jndn.MetaInfo},
+   * etc.
+   * @param bytes an {@link InputStream} to the bytes to segment
+   * @return a list of segmented {@link Data} packets
+   * @throws IOException if the stream fails
+   */
+  public static List<Data> segment(Data template, InputStream bytes, int segmentSize) throws IOException {
+    List<Data> segments = new ArrayList<>();
+    byte[] readBytes = readAll(bytes);
+    int numBytes = readBytes.length;
+    int numPackets = (int) Math.ceil((double) numBytes / segmentSize);
+    ByteBuffer buffer = ByteBuffer.wrap(readBytes, 0, numBytes);
+    Name.Component lastSegment = Name.Component.fromNumberWithMarker((long) numPackets - 1, NDN_SEGMENT_MARKER);
+
+    for (int i = 0; i < numPackets; i++) {
+      Data segment = new Data(template);
+      segment.getName().appendSegment(i);
+      segment.getMetaInfo().setFinalBlockId(lastSegment);
+      byte[] content = new byte[Math.min(segmentSize, buffer.remaining())];
+      buffer.get(content);
+      segment.setContent(new Blob(content));
+      segments.add(segment);
+    }
+
+    return segments;
+  }
+
+  /**
+   * Read all of the bytes in an input stream.
+   *
+   * @param bytes the {@link InputStream} of bytes to read
+   * @return an array of all bytes retrieved from the stream
+   * @throws IOException if the stream fails
+   */
+  public static byte[] readAll(InputStream bytes) throws IOException {
+    ByteArrayOutputStream builder = new ByteArrayOutputStream();
+    int read = bytes.read();
+    while (read != -1) {
+      builder.write(read);
+      read = bytes.read();
+    }
+    builder.flush();
+    bytes.close();
+    return builder.toByteArray();
+  }
+}
diff --git a/src/main/java/com/intel/jndn/utils/impl/SegmentedServerHelper.java b/src/main/java/com/intel/jndn/utils/impl/SegmentedServerHelper.java
deleted file mode 100644
index 8fd4cdb..0000000
--- a/src/main/java/com/intel/jndn/utils/impl/SegmentedServerHelper.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * jndn-utils
- * Copyright (c) 2016, 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.impl;
-
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.util.Blob;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Helper for segmenting an input stream into a list of Data packets. Current
- * use of the default segment size of 4096 (only for
- * {@link #segment(net.named_data.jndn.Data, java.io.InputStream)} is based on
- * several assumptions: NDN packet size was limited to 8000 at the time this was
- * written and signature size is unknown.
- *
- * @author Andrew Brown, andrew.brown@intel.com
- */
-public class SegmentedServerHelper {
-
-  public static final int DEFAULT_SEGMENT_SIZE = 4096;
-
-  /**
-   * Segment a stream of bytes into a list of Data packets; this must read all
-   * the bytes first in order to determine the end segment for FinalBlockId.
-   *
-   * @param template the {@link Data} packet to use for the segment {@link Name},
-   * {@link net.named_data.jndn.MetaInfo}, etc.
-   * @param bytes an {@link InputStream} to the bytes to segment
-   * @return a list of segmented {@link Data} packets
-   * @throws IOException if the stream fails
-   */
-  public static List<Data> segment(Data template, InputStream bytes) throws IOException {
-    return segment(template, bytes, DEFAULT_SEGMENT_SIZE);
-  }
-
-  /**
-   * Segment a stream of bytes into a list of Data packets; this must read all
-   * the bytes first in order to determine the end segment for FinalBlockId.
-   *
-   * @param template the {@link Data} packet to use for the segment {@link Name},
-   * {@link net.named_data.jndn.MetaInfo}, etc.
-   * @param bytes an {@link InputStream} to the bytes to segment
-   * @return a list of segmented {@link Data} packets
-   * @throws IOException if the stream fails
-   */
-  public static List<Data> segment(Data template, InputStream bytes, int segmentSize) throws IOException {
-    List<Data> segments = new ArrayList<>();
-    byte[] buffer_ = readAll(bytes);
-    int numBytes = buffer_.length;
-    int numPackets = (int) Math.ceil((double) numBytes / segmentSize);
-    ByteBuffer buffer = ByteBuffer.wrap(buffer_, 0, numBytes);
-    Name.Component lastSegment = Name.Component.fromNumberWithMarker(numPackets - 1, 0x00);
-
-    for (int i = 0; i < numPackets; i++) {
-      Data segment = new Data(template);
-      segment.getName().appendSegment(i);
-      segment.getMetaInfo().setFinalBlockId(lastSegment);
-      byte[] content = new byte[Math.min(segmentSize, buffer.remaining())];
-      buffer.get(content);
-      segment.setContent(new Blob(content));
-      segments.add(segment);
-    }
-
-    return segments;
-  }
-
-  /**
-   * Read all of the bytes in an input stream.
-   *
-   * @param bytes the {@link InputStream} of bytes to read
-   * @return an array of all bytes retrieved from the stream
-   * @throws IOException if the stream fails
-   */
-  public static byte[] readAll(InputStream bytes) throws IOException {
-    ByteArrayOutputStream builder = new ByteArrayOutputStream();
-    int read = bytes.read();
-    while (read != -1) {
-      builder.write(read);
-      read = bytes.read();
-    }
-    builder.flush();
-    bytes.close();
-    return builder.toByteArray();
-  }
-}
diff --git a/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServer.java b/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServer.java
index faade78..38a4fde 100644
--- a/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServer.java
+++ b/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServer.java
@@ -1,6 +1,6 @@
 /*
  * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2016, 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,
@@ -14,6 +14,7 @@
 package com.intel.jndn.utils.server.impl;
 
 import com.intel.jndn.utils.Repository;
+import com.intel.jndn.utils.impl.SegmentationHelper;
 import com.intel.jndn.utils.repository.impl.ForLoopRepository;
 import com.intel.jndn.utils.server.RepositoryServer;
 import net.named_data.jndn.Data;
@@ -57,9 +58,9 @@
       register();
     }
 
-    if (data.getContent().size() >= SegmentedServerHelper.DEFAULT_SEGMENT_SIZE) {
+    if (data.getContent().size() >= SegmentationHelper.DEFAULT_SEGMENT_SIZE) {
       InputStream stream = new ByteArrayInputStream(data.getContent().getImmutableArray());
-      List<Data> segments = SegmentedServerHelper.segment(data, stream);
+      List<Data> segments = SegmentationHelper.segment(data, stream);
       for (Data segment : segments) {
         logger.fine("Adding segment: " + segment.getName().toUri());
         repository.put(segment);
diff --git a/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientFileTestIT.java b/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientFileTestIT.java
index eab7055..f691a1c 100644
--- a/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientFileTestIT.java
+++ b/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientFileTestIT.java
@@ -1,6 +1,6 @@
 /*
  * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2016, 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,
@@ -15,7 +15,7 @@
 
 import com.intel.jndn.utils.Client;
 import com.intel.jndn.utils.TestHelper;
-import com.intel.jndn.utils.server.impl.SegmentedServerHelper;
+import com.intel.jndn.utils.impl.SegmentationHelper;
 import net.named_data.jndn.Data;
 import net.named_data.jndn.Face;
 import net.named_data.jndn.Interest;
@@ -107,7 +107,7 @@
       data.getMetaInfo().setFreshnessPeriod(0);
 
       try {
-        for (Data segment : SegmentedServerHelper.segment(data, bytes, segmentSize)) {
+        for (Data segment : SegmentationHelper.segment(data, bytes, segmentSize)) {
           logger.log(Level.INFO, "Put data: " + segment.getName().toUri());
           face.putData(segment);
         }
diff --git a/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientStressTestIT.java b/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientStressTestIT.java
index af3232b..ae99b6d 100644
--- a/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientStressTestIT.java
+++ b/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientStressTestIT.java
@@ -1,6 +1,6 @@
 /*
  * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2016, 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,
@@ -15,7 +15,7 @@
 
 import com.intel.jndn.utils.Client;
 import com.intel.jndn.utils.TestHelper;
-import com.intel.jndn.utils.server.impl.SegmentedServerHelper;
+import com.intel.jndn.utils.impl.SegmentationHelper;
 import net.named_data.jndn.Data;
 import net.named_data.jndn.Face;
 import net.named_data.jndn.Interest;
@@ -107,7 +107,7 @@
       data.getMetaInfo().setFreshnessPeriod(0);
 
       try {
-        for (Data segment : SegmentedServerHelper.segment(data, bytes, segmentSize)) {
+        for (Data segment : SegmentationHelper.segment(data, bytes, segmentSize)) {
           logger.log(Level.INFO, "Put data: " + segment.getName().toUri());
           face.putData(segment);
         }
diff --git a/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientTest.java b/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientTest.java
index 3ee3bb8..0109fd0 100644
--- a/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientTest.java
+++ b/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientTest.java
@@ -1,6 +1,6 @@
 /*
  * jndn-utils
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2016, 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,
@@ -17,6 +17,7 @@
 import com.intel.jndn.mock.MockForwarder;
 import com.intel.jndn.utils.TestHelper;
 import com.intel.jndn.utils.client.SegmentationType;
+import com.intel.jndn.utils.impl.SegmentationHelper;
 import net.named_data.jndn.Data;
 import net.named_data.jndn.Face;
 import net.named_data.jndn.Interest;
diff --git a/src/test/java/com/intel/jndn/utils/impl/SegmentationHelperTest.java b/src/test/java/com/intel/jndn/utils/impl/SegmentationHelperTest.java
new file mode 100644
index 0000000..f9d5384
--- /dev/null
+++ b/src/test/java/com/intel/jndn/utils/impl/SegmentationHelperTest.java
@@ -0,0 +1,112 @@
+/*
+ * jndn-utils
+ * Copyright (c) 2016, 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.impl;
+
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Name;
+import net.named_data.jndn.encoding.EncodingException;
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.List;
+
+import static org.junit.Assert.*;
+
+/**
+ * Test the SegmentationHelper
+ *
+ * @author Andrew Brown, andrew.brown@intel.com
+ */
+public class SegmentationHelperTest {
+
+  private static final byte MARKER = 0x0F;
+
+  @Test
+  public void testSegmentation() throws Exception {
+    final Data template = new Data(new Name("/segmented/data"));
+    final InputStream content = new ByteArrayInputStream("0123456789".getBytes());
+    List<Data> segments = SegmentationHelper.segment(template, content, 1);
+    assertEquals(10, segments.size());
+
+    // test first packet
+    assertEquals(0, segments.get(0).getName().get(-1).toSegment());
+    assertEquals(9, segments.get(0).getMetaInfo().getFinalBlockId().toSegment());
+    assertEquals("0", segments.get(0).getContent().toString());
+
+    // test last packet
+    assertEquals(9, segments.get(9).getName().get(-1).toSegment());
+    assertEquals(9, segments.get(9).getMetaInfo().getFinalBlockId().toSegment());
+    assertEquals("9", segments.get(9).getContent().toString());
+  }
+
+  @Test
+  public void testSegmentationDifferentSizes() throws Exception {
+    final Data template = new Data(new Name("/segmented/data"));
+
+    // size 2
+    final InputStream content2 = new ByteArrayInputStream("0123456789".getBytes());
+    List<Data> segments2 = SegmentationHelper.segment(template, content2, 2);
+    assertEquals(5, segments2.size());
+    assertEquals("89", segments2.get(4).getContent().toString());
+
+    // size 3
+    final InputStream content3 = new ByteArrayInputStream("0123456789".getBytes());
+    List<Data> segments3 = SegmentationHelper.segment(template, content3, 3);
+    assertEquals(4, segments3.size());
+    assertEquals("9", segments3.get(3).getContent().toString());
+
+    // size 4
+    final InputStream content4 = new ByteArrayInputStream("0123456789".getBytes());
+    List<Data> segments4 = SegmentationHelper.segment(template, content4, 4);
+    assertEquals(3, segments4.size());
+    assertEquals("89", segments4.get(2).getContent().toString());
+  }
+
+  @Test
+  public void isSegmented() {
+    Name.Component component = Name.Component.fromNumberWithMarker(42, MARKER);
+    assertTrue(SegmentationHelper.isSegmented(new Name("/segmented/data").append(component), MARKER));
+  }
+
+  @Test
+  public void isNotSegmented() {
+    assertFalse(SegmentationHelper.isSegmented(new Name("/segmented/data"), MARKER));
+  }
+
+  @Test
+  public void parseSegment() throws Exception {
+    Name.Component component = Name.Component.fromNumberWithMarker(42, MARKER);
+    assertEquals(42, SegmentationHelper.parseSegment(new Name("/segmented/data").append(component), MARKER));
+  }
+
+  @Test(expected = EncodingException.class)
+  public void parseMissingSegment() throws Exception {
+    SegmentationHelper.parseSegment(new Name("/segmented/data"), MARKER);
+  }
+
+  @Test
+  public void removeSegment() throws Exception {
+    Name unsegmentedName = new Name("/name");
+    Name segmentedName = new Name(unsegmentedName).append(Name.Component.fromNumberWithMarker(42, MARKER));
+    assertEquals(unsegmentedName, SegmentationHelper.removeSegment(segmentedName, MARKER));
+  }
+
+  @Test
+  public void removeNoSegment() throws Exception {
+    Name unsegmentedName = new Name("/unsegmented/name");
+    assertEquals(unsegmentedName, SegmentationHelper.removeSegment(unsegmentedName, MARKER));
+  }
+}
diff --git a/src/test/java/com/intel/jndn/utils/server/impl/SegmentedServerHelperTest.java b/src/test/java/com/intel/jndn/utils/server/impl/SegmentedServerHelperTest.java
deleted file mode 100644
index d46ebc4..0000000
--- a/src/test/java/com/intel/jndn/utils/server/impl/SegmentedServerHelperTest.java
+++ /dev/null
@@ -1,83 +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.server.impl;
-
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Name;
-import org.junit.Test;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Test the SegmentedServerHelper
- *
- * @author Andrew Brown, andrew.brown@intel.com
- */
-public class SegmentedServerHelperTest {
-
-  /**
-   * Test of segment method, of class SegmentedServerHelper.
-   *
-   * @throws java.lang.Exception
-   */
-  @Test
-  public void testSegmentation() throws Exception {
-    final Data template = new Data(new Name("/segmented/data"));
-    final InputStream content = new ByteArrayInputStream("0123456789".getBytes());
-    List<Data> segments = SegmentedServerHelper.segment(template, content, 1);
-    assertEquals(10, segments.size());
-
-    // test first packet
-    assertEquals(0, segments.get(0).getName().get(-1).toSegment());
-    assertEquals(9, segments.get(0).getMetaInfo().getFinalBlockId().toSegment());
-    assertEquals("0", segments.get(0).getContent().toString());
-
-    // test last packet
-    assertEquals(9, segments.get(9).getName().get(-1).toSegment());
-    assertEquals(9, segments.get(9).getMetaInfo().getFinalBlockId().toSegment());
-    assertEquals("9", segments.get(9).getContent().toString());
-  }
-
-   /**
-   * Test of segment method, of class SegmentedServerHelper.
-   *
-   * @throws java.lang.Exception
-   */
-  @Test
-  public void testSegmentationDifferentSizes() throws Exception {
-    final Data template = new Data(new Name("/segmented/data"));
-
-    // size 2
-    final InputStream content2 = new ByteArrayInputStream("0123456789".getBytes());
-    List<Data> segments2 = SegmentedServerHelper.segment(template, content2, 2);
-    assertEquals(5, segments2.size());
-    assertEquals("89", segments2.get(4).getContent().toString());
-
-    // size 3
-    final InputStream content3 = new ByteArrayInputStream("0123456789".getBytes());
-    List<Data> segments3 = SegmentedServerHelper.segment(template, content3, 3);
-    assertEquals(4, segments3.size());
-    assertEquals("9", segments3.get(3).getContent().toString());
-
-    // size 4
-    final InputStream content4 = new ByteArrayInputStream("0123456789".getBytes());
-    List<Data> segments4 = SegmentedServerHelper.segment(template, content4, 4);
-    assertEquals(3, segments4.size());
-    assertEquals("89", segments4.get(2).getContent().toString());
-  }
-}