Add ability to retrieve registered prefix ID of a Server
diff --git a/src/main/java/com/intel/jndn/utils/server/Server.java b/src/main/java/com/intel/jndn/utils/server/Server.java
index ba4ff1c..bc5eca7 100644
--- a/src/main/java/com/intel/jndn/utils/server/Server.java
+++ b/src/main/java/com/intel/jndn/utils/server/Server.java
@@ -35,6 +35,12 @@
   public Name getPrefix();
 
   /**
+   * @return the registered prefix ID of the server on the {@link Face} or -1 if
+   * unregistered
+   */
+  public long getRegisteredPrefixId();
+
+  /**
    * Add a stage to the server pipeline. Each stage should be processed once the
    * server has the {@link Data} packet available to send (e.g. after a callback
    * has produced a packet); also, stages should be processed in the order they
diff --git a/src/main/java/com/intel/jndn/utils/server/ServerBaseImpl.java b/src/main/java/com/intel/jndn/utils/server/ServerBaseImpl.java
index 0d150d6..54281e6 100644
--- a/src/main/java/com/intel/jndn/utils/server/ServerBaseImpl.java
+++ b/src/main/java/com/intel/jndn/utils/server/ServerBaseImpl.java
@@ -32,11 +32,12 @@
  */
 public abstract class ServerBaseImpl implements Server {
 
+  public static final long UNREGISTERED = -1;
   private static final Logger logger = Logger.getLogger(ServerBaseImpl.class.getName());
   private final Face face;
   private final Name prefix;
   private final List<PipelineStage> pipeline = new ArrayList<>();
-  private boolean registered = false;
+  private long registeredPrefixId = UNREGISTERED;
 
   /**
    * Build the base server; register() must run separately and is run
@@ -60,10 +61,18 @@
   }
 
   /**
+   * {@inheritDoc}
+   */
+  @Override
+  public long getRegisteredPrefixId() {
+    return registeredPrefixId;
+  }
+
+  /**
    * @return true if the server has registered a prefix on the face
    */
   public boolean isRegistered() {
-    return registered;
+    return registeredPrefixId == UNREGISTERED;
   }
 
   /**
@@ -72,17 +81,15 @@
    * @throws java.io.IOException if IO fails
    */
   public void register() throws IOException {
-    registered = true;
     try {
-      face.registerPrefix(prefix, this, new OnRegisterFailed() {
+      registeredPrefixId = face.registerPrefix(prefix, this, new OnRegisterFailed() {
         @Override
         public void onRegisterFailed(Name prefix) {
-          registered = false;
+          registeredPrefixId = UNREGISTERED;
           logger.log(Level.SEVERE, "Failed to register prefix: " + prefix.toUri());
         }
       }, new ForwardingFlags());
     } catch (net.named_data.jndn.security.SecurityException e) {
-      registered = false;
       throw new IOException("Failed to communicate to face due to security error", e);
     }
   }
diff --git a/src/test/java/com/intel/jndn/utils/server/ServerBaseImplTest.java b/src/test/java/com/intel/jndn/utils/server/ServerBaseImplTest.java
index 41cdf3c..e352768 100644
--- a/src/test/java/com/intel/jndn/utils/server/ServerBaseImplTest.java
+++ b/src/test/java/com/intel/jndn/utils/server/ServerBaseImplTest.java
@@ -53,6 +53,13 @@
   public void testGetPrefix() {
     assertNotNull(instance.getPrefix());
   }
+  
+  /**
+   * Test of getRegisteredPrefixId method, of class ServerBaseImpl
+   */
+  public void testGetRegisteredPrefixId(){
+    assertEquals(ServerBaseImpl.UNREGISTERED, instance.getRegisteredPrefixId());
+  }
 
   /**
    * Test of register method, of class ServerBaseImpl.