diff --git a/src/test/java/com/intel/jndn/utils/SegmentedServerTestIT.java b/src/test/java/com/intel/jndn/utils/SegmentedServerTestIT.java
new file mode 100644
index 0000000..3b78b74
--- /dev/null
+++ b/src/test/java/com/intel/jndn/utils/SegmentedServerTestIT.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;
+
+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.Name;
+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 static org.junit.Assert.*;
+import org.junit.Test;
+
+/**
+ * Test the {@link SegmentedServer} on an actual NFD; to run this, pass the NFD
+ * IP/host name as a parameter like <code>-Dnfd.ip=10.1.1.1</code>.
+ *
+ * @author Andrew Brown <andrew.brown@intel.com>
+ */
+public class SegmentedServerTestIT {
+
+  private static final Logger logger = Logger.getLogger(SegmentedServerTestIT.class.getName());
+  Name prefix;
+  Face face;
+  SegmentedServer instance;
+  private String ip;
+
+  public SegmentedServerTestIT() throws SecurityException {
+    this.ip = System.getProperty("nfd.ip");
+    this.prefix = new Name("/test/for/segmented-server");
+    this.face = new Face(ip);
+    this.instance = new SegmentedServer(face, prefix);
+    KeyChain mockKeyChain = MockKeyChain.configure(new Name("/test/server"));
+    face.setCommandSigningInfo(mockKeyChain, mockKeyChain.getDefaultCertificateName());
+  }
+
+  @Test
+  public void testRegisterAndRetrieval() throws Exception {
+    final Name name = new Name(prefix).append("1");
+
+    // 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());
+        } catch (IOException ex) {
+          logger.info("Failed to serve data: " + name.toUri());
+        }
+
+        while (true) {
+          try {
+            face.processEvents();
+          } catch (IOException | EncodingException ex) {
+            logger.info("Failed while processing events.");
+          }
+        }
+      }
+    }).start();
+
+    // why wait? we want to make sure the thread is running and that the prefix
+    // registration has succeeded on the NFD before we send interests
+    Thread.sleep(1000);
+
+    // 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);
+    assertNotNull(retrieved);
+    assertEquals("...", retrieved.getContent().toString());
+  }
+}
