Fix indentation, add documentation, and remove unneeded files

Change-Id: Ie40ec66c611690656ca451759f82154686ca0ec3
diff --git a/README.md b/README.md
index a0011f6..e282cef 100644
--- a/README.md
+++ b/README.md
@@ -3,8 +3,9 @@
 This project consists of tools for testing NDN applications without network IO. It relies on the [NDN Protocol](https://named-data.net) and its associated [client library](https://github.com/named-data/jndn).
 
 ## Install
+
 With Maven, add the following to your POM:
-```
+```xml
 <dependency>
   <groupId>com.intel.jndn.mock</groupId>
   <artifactId>jndn-mock</artifactId>
@@ -13,18 +14,30 @@
 ```
 
 ## Use
-`MockFace` and `MockTransport` are test tools that can be passed to applications instead of the typical `Face` and `Transport`. For example:
-```
-MockTransport transport = new MockTransport();
-MockFace face = new MockFace(transport, null);
 
-application.doSomethingOn(face);
-assertEquals(0, transport.getSentDataPackets().size());
-assertEquals(1, transport.getSentInterestPackets().size());
+`MockFace` is a test tool that can be passed to applications instead of a network IO `Face`; management of the `Face.processEvents()` is still the user's responsibility, though this may change in a future release. For example:
+```java
+Face face = new MockFace();
+face.expressInterest(interest, onData, onTimeout);
+face.processEvents();
+```
+
+When using the `MockFace`, retrieve statistics about sent/received Interests and Data packets like:
+```java
+MockFace face = new MockFace();
+assertEquals(0, face.sentDatas.size());
+assertEquals(0, face.sentInterests.size());
+
+face.expressInterest(interest, onData, onTimeout);
+...
+face.processEvents();
+...
+assertEquals(1, face.sentInterests.size());
 ```
 
 ## License
-Copyright © 2015, Intel Corporation.
+
+Copyright 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.
 
diff --git a/pom.xml b/pom.xml
index 0f36b5b..40b56d0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,6 +19,10 @@
       <name>Andrew Brown</name>
       <url>http://github.com/andrewsbrown</url>
     </developer>
+    <developer>
+      <name>Alexander Afanasyev</name>
+      <email>aa@cs.ucla.edu</email>
+    </developer>
   </developers>
   <scm>
     <url>https://github.com/01org/jndn-mock</url>
diff --git a/src/main/java/com/intel/jndn/mock/MockFace.java b/src/main/java/com/intel/jndn/mock/MockFace.java
index 8b78329..cf2f477 100644
--- a/src/main/java/com/intel/jndn/mock/MockFace.java
+++ b/src/main/java/com/intel/jndn/mock/MockFace.java
@@ -31,39 +31,51 @@
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
-/** A client-side face for unit testing
+/**
+ * A client-side face for unit testing
  */
-public class MockFace extends Face
-{
+public class MockFace extends Face {
+
   public interface SignalOnSendInterest {
+
     void emit(Interest interest) throws EncodingException, SecurityException;
   }
 
   public interface SignalOnSendData {
+
     void emit(Data data);
   }
 
   /**
    * Options for MockFace
    */
-  public static class Options
-  {
-    /** If true, packets sent out of MockFace will be appended to a container
+  public static class Options {
+
+    /**
+     * If true, packets sent out of MockFace will be appended to a container
      */
     boolean enablePacketLogging = false;
 
     /**
-     * If true, prefix registration command will be automatically replied with a successful response
+     * If true, prefix registration command will be automatically replied with a
+     * successful response
      */
     boolean enableRegistrationReply = false;
   }
 
-  final public static Options DEFAULT_OPTIONS = new Options(){{ enablePacketLogging=true; enableRegistrationReply=true; }};
+  final public static Options DEFAULT_OPTIONS = new Options() {
+    {
+      enablePacketLogging = true;
+      enableRegistrationReply = true;
+    }
+  };
 
   /**
-   * Create MockFace that logs packets in sentInterests and sentData and emulates NFD prefix registration
+   * Create MockFace that logs packets in sentInterests and sentData and
+   * emulates NFD prefix registration
    */
   public MockFace() throws SecurityException {
     this(DEFAULT_OPTIONS);
@@ -87,7 +99,7 @@
    */
   public MockFace(Options options) throws SecurityException {
     super(new MockFaceTransport(), null);
-    m_transport = (MockFaceTransport)node_.getTransport();
+    m_transport = (MockFaceTransport) node_.getTransport();
     m_keychain = MockKeyChain.configure(new Name("/mock/key"));
     setCommandSigningInfo(m_keychain, m_keychain.getDefaultCertificateName());
 
@@ -113,8 +125,7 @@
               signal.emit(data);
             }
           }
-        }
-        else {
+        } else {
           logger.info("Received an unknown packet");
         }
       }
@@ -176,6 +187,8 @@
 
   /**
    * Mock reception of the Interest packet on the Face (from transport)
+   * @param interest the mock-remote interest to add to the PIT
+   * @throws EncodingException if packet encoding fails (it should not)
    */
   public void receive(Interest interest) throws EncodingException {
     m_transport.receive(interest.wireEncode().buf());
@@ -183,49 +196,63 @@
 
   /**
    * Mock reception of the Data packet on the Face (from transport)
+   * @param data the mock-remote data to add to the CS
+   * @throws EncodingException if packet encoding fails (it should not)
    */
   public void receive(Data data) throws EncodingException {
     m_transport.receive(data.wireEncode().buf());
   }
 
+  /**
+   * @return the transport for this face
+   */
   public Transport getTransport() {
     return m_transport;
   }
 
-  //////////////////////////////////////////////////////////////////////////////
-  //////////////////////////////////////////////////////////////////////////////
-  //////////////////////////////////////////////////////////////////////////////
-
   /**
-   * Internal transport for MockFace
+   * Internal transport for {@link MockFace}
    */
   private static class MockFaceTransport extends Transport {
+
     public interface OnSendBlockSignal {
+
       void emit(ByteBuffer buffer) throws EncodingException, SecurityException;
     }
 
-    public void
-    receive(ByteBuffer block) throws EncodingException {
-      synchronized (m_recvBuffer) {
-        m_recvBuffer.add(block.duplicate());
+    /**
+     * Receive some bytes to add to the mock socket
+     * @param block the byte buffer
+     * @throws EncodingException 
+     */
+    public void receive(ByteBuffer block) throws EncodingException {
+      synchronized (receiveBuffer) {
+        receiveBuffer.add(block.duplicate());
       }
     }
 
-    // from Transport
-
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public boolean isLocal(ConnectionInfo connectionInfo) {
       return true;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public boolean isAsync() {
       return false;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public void connect(Transport.ConnectionInfo connectionInfo,
-                        ElementListener elementListener, Runnable onConnected) {
+            ElementListener elementListener, Runnable onConnected) {
       logger.fine("Connecting...");
       connected = true;
       elementReader = new ElementReader(elementListener);
@@ -234,19 +261,25 @@
       }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public void send(ByteBuffer data) throws IOException {
-      logger.fine("Sending " + (data.capacity() - data.position()) + " bytes");
+      logger.log(Level.FINE, "Sending {0} bytes", (data.capacity() - data.position()));
 
       try {
         onSendBlock.emit(data);
       } catch (EncodingException e) {
-        logger.info("TLV decoding error: " + e.toString());
+        logger.log(Level.WARNING, "Failed to decode packet", e);
       } catch (SecurityException e) {
-        logger.info("Signing error: " + e.toString());
+        logger.log(Level.WARNING, "Failed signature", e);
       }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public void processEvents() throws IOException, EncodingException {
       if (!getIsConnected()) {
@@ -255,9 +288,9 @@
 
       while (true) {
         ByteBuffer block = null;
-        synchronized (m_recvBuffer) {
-          if (!m_recvBuffer.isEmpty()) {
-            block = m_recvBuffer.remove(0);
+        synchronized (receiveBuffer) {
+          if (!receiveBuffer.isEmpty()) {
+            block = receiveBuffer.remove(0);
           }
         }
         if (block == null) {
@@ -267,69 +300,66 @@
       }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public boolean getIsConnected() {
       return connected;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public void close() throws IOException {
       logger.fine("Closing...");
       connected = false;
     }
 
-    //////////////////////////////////////////////////////////////////////////////
-
     public OnSendBlockSignal onSendBlock;
 
-    //////////////////////////////////////////////////////////////////////////////
-
     private static final Logger logger = Logger.getLogger(MockFaceTransport.class.getName());
-
     private boolean connected;
     private ElementReader elementReader;
-    private final List<ByteBuffer> m_recvBuffer = new LinkedList<ByteBuffer>();
+    private final List<ByteBuffer> receiveBuffer = new LinkedList<>();
   }
 
-  //////////////////////////////////////////////////////////////////////////////
-  //////////////////////////////////////////////////////////////////////////////
-  //////////////////////////////////////////////////////////////////////////////
-
   /**
    * Interests sent out of this MockFace
    * <p>
-   * Sent Interests are appended to this container if options.enablePacketLogger is true.
-   * User of this class is responsible for cleaning up the container, if necessary.
-   * After .expressInterest, .processEvents must be called before the Interest would show up here.
+   * Sent Interests are appended to this container if options.enablePacketLogger
+   * is true. User of this class is responsible for cleaning up the container,
+   * if necessary. After .expressInterest, .processEvents must be called before
+   * the Interest would show up here.
    */
-  public List<Interest> sentInterests = new ArrayList<Interest>();
+  public List<Interest> sentInterests = new ArrayList<>();
 
   /**
    * Data sent out of this MockFace
    * <p>
-   * Sent Data are appended to this container if options.enablePacketLogger is true.
-   * User of this class is responsible for cleaning up the container, if necessary.
-   * After .put, .processEvents must be called before the Data would show up here.
+   * Sent Data are appended to this container if options.enablePacketLogger is
+   * true. User of this class is responsible for cleaning up the container, if
+   * necessary. After .put, .processEvents must be called before the Data would
+   * show up here.
    */
-  public List<Data> sentData = new ArrayList<Data>();
+  public List<Data> sentData = new ArrayList<>();
 
   /**
    * Emits whenever an Interest is sent
    * <p>
-   * After .expressInterest, .processEvents must be called before this signal would be emitted.
+   * After .expressInterest, .processEvents must be called before this signal
+   * would be emitted.
    */
-  public List<SignalOnSendInterest> onSendInterest = new ArrayList<SignalOnSendInterest>();
+  public List<SignalOnSendInterest> onSendInterest = new ArrayList<>();
 
   /**
    * Emits whenever a Data packet is sent
    * <p>
-   * After .putData, .processEvents must be called before this signal would be emitted.
+   * After .putData, .processEvents must be called before this signal would be
+   * emitted.
    */
-  public List<SignalOnSendData> onSendData = new ArrayList<SignalOnSendData>();
-
-  //////////////////////////////////////////////////////////////////////////////
-  //////////////////////////////////////////////////////////////////////////////
-  //////////////////////////////////////////////////////////////////////////////
+  public List<SignalOnSendData> onSendData = new ArrayList<>();
 
   private static final Logger logger = Logger.getLogger(MockFace.class.getName());
   private MockFaceTransport m_transport;
diff --git a/src/main/java/com/intel/jndn/mock/MockKeyChain.java b/src/main/java/com/intel/jndn/mock/MockKeyChain.java
index 87b82ec..2933c0a 100644
--- a/src/main/java/com/intel/jndn/mock/MockKeyChain.java
+++ b/src/main/java/com/intel/jndn/mock/MockKeyChain.java
@@ -23,6 +23,7 @@
 import net.named_data.jndn.security.policy.SelfVerifyPolicyManager;
 
 /**
+ * Create an in-memory key chain for use in NDN-related tests
  *
  * @author Andrew Brown <andrew.brown@intel.com>
  */
diff --git a/src/main/resources/log4j2-test.xml b/src/main/resources/log4j2-test.xml
deleted file mode 100644
index 602b5ab..0000000
--- a/src/main/resources/log4j2-test.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Configuration status="WARN">
-  <Appenders>
-    <Console name="Console" target="SYSTEM_OUT">
-      <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
-    </Console>
-  </Appenders>
-  <Loggers>
-    <Root level="info">
-      <AppenderRef ref="Console"/>
-    </Root>
-  </Loggers>
-</Configuration>
\ No newline at end of file
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
deleted file mode 100644
index 0dac33a..0000000
--- a/src/main/resources/log4j2.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Configuration status="WARN">
-  <Appenders>
-    <Console name="Console" target="SYSTEM_OUT">
-      <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
-    </Console>
-  </Appenders>
-  <Loggers>
-    <Root level="warn">
-      <AppenderRef ref="Console"/>
-    </Root>
-  </Loggers>
-</Configuration>
\ No newline at end of file
diff --git a/src/test/java/com/intel/jndn/mock/MockFaceTest.java b/src/test/java/com/intel/jndn/mock/MockFaceTest.java
index 144a05e..9682f95 100644
--- a/src/test/java/com/intel/jndn/mock/MockFaceTest.java
+++ b/src/test/java/com/intel/jndn/mock/MockFaceTest.java
@@ -29,6 +29,7 @@
  * Test MockFace functionality
  */
 public class MockFaceTest {
+
   @Before
   public void setup() throws SecurityException {
     face = new MockFace();
@@ -38,10 +39,8 @@
     exception = null;
   }
 
-  /////////////////////////////////////////////////////////////////////////////
-
   @Test
-  public void ExpressInterest() throws IOException, EncodingException, InterruptedException {
+  public void testExpressingAnInterest() throws IOException, EncodingException, InterruptedException {
     // make request
     expressInterest("/test/with/responses");
 
@@ -54,14 +53,14 @@
 
     run(20);
 
-    assertNotEquals(recvData, null);
+    assertNotNull(recvData);
     assertEquals(isTimeout, false);
     assertEquals(recvData.getName().toString(), "/test/with/responses");
     assertEquals(recvData.getContent().buf(), new Blob("...").buf());
   }
 
   @Test
-  public void ExpressInterest2() throws IOException, EncodingException, InterruptedException {
+  public void testExpressingAnInterestAfterConfiguration() throws IOException, EncodingException, InterruptedException {
     // add response (before face is connected)
     Data response = new Data(new Name("/test/with/responses"));
     response.setContent(new Blob("..."));
@@ -72,14 +71,14 @@
 
     run(20);
 
-    assertNotEquals(recvData, null);
+    assertNotNull(recvData);
     assertEquals(isTimeout, false);
     assertEquals(recvData.getName().toString(), "/test/with/responses");
     assertEquals(recvData.getContent().buf(), new Blob("...").buf());
   }
 
   @Test
-  public void ExpressInterestTimeout() throws IOException, EncodingException, InterruptedException {
+  public void testInterestTimeouts() throws IOException, EncodingException, InterruptedException {
     // make request
     expressInterest("/some/name");
 
@@ -90,7 +89,7 @@
   }
 
   @Test
-  public void RegisterPrefix() throws IOException, SecurityException, EncodingException, InterruptedException {
+  public void testPrefixRegistration() throws IOException, SecurityException, EncodingException, InterruptedException {
     class State {
       boolean regFailed = false;
       boolean regSucceed = false;
@@ -98,38 +97,34 @@
     final State state = new State();
 
     logger.info("Register prefix: /test/with/handlers");
-    face.registerPrefix(new Name("/test/with/handlers"),
-      new OnInterestCallback() {
-        @Override
-        public void onInterest(Name prefix, Interest interest, Face face, long interestFilterId, InterestFilter filter) {
-          logger.info("Received interest, responding: " + interest.getName().toUri());
-          Data response = new Data(new Name("/test/with/handlers"));
-          response.setContent(new Blob("..."));
-          try {
-            face.putData(response);
-          } catch (IOException e) {
-            exception = e;
-          }
-          counter++;
+    face.registerPrefix(new Name("/test/with/handlers"), new OnInterestCallback() {
+      @Override
+      public void onInterest(Name prefix, Interest interest, Face face, long interestFilterId, InterestFilter filter) {
+        logger.info("Received interest, responding: " + interest.getName().toUri());
+        Data response = new Data(new Name("/test/with/handlers"));
+        response.setContent(new Blob("..."));
+        try {
+          face.putData(response);
+        } catch (IOException e) {
+          exception = e;
         }
-      },
-      new OnRegisterFailed() {
-        @Override
-        public void onRegisterFailed(Name prefix) {
-          logger.info("Prefix registration fails: " + prefix);
-          state.regFailed = true;
-          counter++;
-        }
-      },
-      new OnRegisterSuccess() {
-        @Override
-        public void onRegisterSuccess(Name prefix, long registeredPrefixId) {
-          logger.info("Prefix registration succeed: " + prefix);
-          state.regSucceed = true;
-          counter++;
-        }
+        counter++;
       }
-    );
+    }, new OnRegisterFailed() {
+      @Override
+      public void onRegisterFailed(Name prefix) {
+        logger.info("Prefix registration fails: " + prefix);
+        state.regFailed = true;
+        counter++;
+      }
+    }, new OnRegisterSuccess() {
+      @Override
+      public void onRegisterSuccess(Name prefix, long registeredPrefixId) {
+        logger.info("Prefix registration succeed: " + prefix);
+        state.regSucceed = true;
+        counter++;
+      }
+    });
 
     run(100, 1);
     assertTrue(state.regSucceed);
@@ -149,15 +144,15 @@
   }
 
   @Test
-  public void RegistrationPrefixConnectTransport() throws IOException, SecurityException {
+  public void testThatTransportConnectsOnPrefixRegistration() throws IOException, SecurityException {
     assertFalse(face.getTransport().getIsConnected());
     face.registerPrefix(new Name("/fake/prefix"), (OnInterestCallback) null, (OnRegisterFailed) null,
-      (OnRegisterSuccess) null);
+            (OnRegisterSuccess) null);
     assertTrue(face.getTransport().getIsConnected());
   }
 
   @Test
-  public void SetInterestFilter() throws IOException, SecurityException, EncodingException, InterruptedException {
+  public void testInterestFilters() throws IOException, SecurityException, EncodingException, InterruptedException {
     class State {
       boolean regFailed = false;
       boolean regSucceed = false;
@@ -214,26 +209,23 @@
     run(limit, 1);
   }
 
-  private void
-  expressInterest(String name) throws IOException {
+  private void expressInterest(String name) throws IOException {
     logger.info("Express interest: " + name);
-    face.expressInterest(new Interest(new Name(name)).setInterestLifetimeMilliseconds(1000), new
-        OnData() {
-          @Override
-          public void onData(Interest interest, Data data) {
-            counter++;
-            logger.fine("Received data");
-            recvData = data;
-          }
-        },
-      new OnTimeout() {
-        @Override
-        public void onTimeout(Interest interest) {
-          logger.fine("Received timeout");
-          counter++;
-          isTimeout = true;
-        }
-      });
+    face.expressInterest(new Interest(new Name(name)).setInterestLifetimeMilliseconds(1000), new OnData() {
+      @Override
+      public void onData(Interest interest, Data data) {
+        counter++;
+        logger.fine("Received data");
+        recvData = data;
+      }
+    }, new OnTimeout() {
+      @Override
+      public void onTimeout(Interest interest) {
+        logger.fine("Received timeout");
+        counter++;
+        isTimeout = true;
+      }
+    });
   }
 
   /////////////////////////////////////////////////////////////////////////////
diff --git a/src/test/java/com/intel/jndn/mock/MockKeyChainTest.java b/src/test/java/com/intel/jndn/mock/MockKeyChainTest.java
index 137d1b4..a599ae9 100644
--- a/src/test/java/com/intel/jndn/mock/MockKeyChainTest.java
+++ b/src/test/java/com/intel/jndn/mock/MockKeyChainTest.java
@@ -20,6 +20,7 @@
 
 /**
  * Test MockKeyChain
+ *
  * @author Andrew Brown <andrew.brown@intel.com>
  */
 public class MockKeyChainTest {