Initial commit
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c7ccd3b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,27 @@
+# Created by https://www.gitignore.io
+
+### Maven ###
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+
+
+### Java ###
+*.class
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.ear
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+# Linux temporary files
+*~
diff --git a/nb-configuration.xml b/nb-configuration.xml
new file mode 100644
index 0000000..7f3f7dc
--- /dev/null
+++ b/nb-configuration.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-shared-configuration>
+    <!--
+This file contains additional configuration written by modules in the NetBeans IDE.
+The configuration is intended to be shared among all the users of project and
+therefore it is assumed to be part of version control checkout.
+Without this configuration present, some functionality in the IDE may be limited or fail altogether.
+-->
+    <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
+        <!--
+Properties that influence various parts of the IDE, especially code formatting and the like. 
+You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
+That way multiple projects can share the same settings (useful for formatting rules for example).
+Any value defined here will override the pom.xml file value but is only applicable to the current project.
+-->
+        <org-netbeans-modules-editor-indent.CodeStyle.usedProfile>project</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab>2</org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>4</org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width>2</org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs>true</org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>80</org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap>none</org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap>
+        <org-netbeans-modules-editor-indent.text.x-fortran.CodeStyle.project.text-limit-width>132</org-netbeans-modules-editor-indent.text.x-fortran.CodeStyle.project.text-limit-width>
+        <org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab>2</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab>
+        <org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size>4</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size>
+        <org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width>2</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width>
+        <org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs>
+        <org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.text-limit-width>80</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.text-limit-width>
+        <org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.text-line-wrap>words</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.text-line-wrap>
+    </properties>
+</project-shared-configuration>
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..1ab8753
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>com.intel.jndn.mock</groupId>
+  <artifactId>jndn-mock</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <dependencies>
+    <dependency>
+      <groupId>net.named_data.jndn</groupId>
+      <artifactId>jndn</artifactId>
+      <version>RELEASE</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <version>2.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <version>2.1</version>
+    </dependency>
+    <!-- Test dependencies -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.10</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <maven.compiler.source>1.7</maven.compiler.source>
+    <maven.compiler.target>1.7</maven.compiler.target>
+  </properties>
+  <distributionManagement>
+    <repository>
+      <id>ubit-artifactory-or.intel.com</id>
+      <name>ubit-artifactory-or.intel.com-releases</name>
+      <url>https://ubit-artifactory-or.intel.com/artifactory/ext-releases-local</url>
+    </repository>
+    <snapshotRepository>
+      <id>ubit-artifactory-or.intel.com</id>
+      <name>ubit-artifactory-or.intel.com-snapshots</name>
+      <url>https://ubit-artifactory-or.intel.com/artifactory/ext-snapshots-local</url>
+    </snapshotRepository>
+  </distributionManagement>
+</project>
\ No newline at end of file
diff --git a/src/main/java/com/intel/jndn/mock/MockTransport.java b/src/main/java/com/intel/jndn/mock/MockTransport.java
new file mode 100644
index 0000000..ee9c4e3
--- /dev/null
+++ b/src/main/java/com/intel/jndn/mock/MockTransport.java
@@ -0,0 +1,174 @@
+/*
+ * File name: MockTransport.java
+ * 
+ * Purpose: Provide testing functionality for running NDN unit tests without
+ * connecting to the network or requiring an NFD installed.
+ * 
+ * © Copyright Intel Corporation. All rights reserved.
+ * Intel Corporation, 2200 Mission College Boulevard,
+ * Santa Clara, CA 95052-8119, USA
+ */
+package com.intel.jndn.mock;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+import net.named_data.jndn.Data;
+import net.named_data.jndn.encoding.ElementListener;
+import net.named_data.jndn.encoding.ElementReader;
+import net.named_data.jndn.encoding.EncodingException;
+import net.named_data.jndn.transport.Transport;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+/**
+ * Mock the transport class Example: ...
+ *
+ * @author Andrew Brown <andrew.brown@intel.com>
+ */
+public class MockTransport extends Transport {
+
+  public final static int BUFFER_CAPACITY = 8000;
+  private static final Logger logger = LogManager.getLogger();
+  protected boolean connected;
+  protected ByteBuffer inputBuffer = ByteBuffer.allocate(BUFFER_CAPACITY);
+  protected ByteBuffer outputBuffer = ByteBuffer.allocate(BUFFER_CAPACITY);
+  protected ElementReader elementReader;
+  protected List<Data> outputPackets = new ArrayList<>();
+
+  /**
+   * Retrieve sent bytes
+   *
+   * @return
+   */
+  public ByteBuffer getSentBuffer() {
+    return outputBuffer;
+  }
+
+  /**
+   * 
+   */
+  public void clear() {
+    throw new UnsupportedOperationException("Not supported yet.");
+  }
+
+  /**
+   * 
+   * @return 
+   */
+  public List<Data> getSentDataPackets() {
+    return outputPackets;
+  }
+
+  /**
+   * Retrieve received bytes; this is mocked by adding bytes to the buffer with
+   * respondWith()
+   *
+   * @return
+   */
+  public ByteBuffer getReceivedBuffer() {
+    return inputBuffer;
+  }
+
+  /**
+   *
+   * @param response
+   */
+  public void respondWith(ByteBuffer response) {
+    inputBuffer.put(response);
+  }
+
+  /**
+   *
+   * @param response
+   */
+  public void respondWith(Data response) {
+    respondWith(response.wireEncode().buf());
+  }
+
+  /**
+   * Mock connection
+   *
+   * @param connectionInfo
+   * @param elementListener
+   * @throws IOException
+   */
+  @Override
+  public void connect(Transport.ConnectionInfo connectionInfo,
+          ElementListener elementListener) throws IOException {
+    logger.debug("Connecting...");
+    connected = true;
+    elementReader = new ElementReader(elementListener);
+  }
+
+  /**
+   * Mock sending data to the host; access the data as bytes using
+   * getSentBuffer() or as packets with getSentDataPackets()
+   *
+   * @param data The buffer of data to send. This reads from position() to
+   * limit(), but does not change the position.
+   * @throws IOException For I/O error.
+   */
+  @Override
+  public void send(ByteBuffer data) throws IOException {
+    logger.debug("Sending " + (data.capacity() - data.position()) + " bytes");
+    
+    // add to sent bytes
+    outputBuffer.put(data);
+    data.flip();
+
+    // add to sent packets
+    try {
+      Data packet = new Data();
+      packet.wireDecode(data);
+      outputPackets.add(new Data());
+    } catch (EncodingException e) {
+      logger.warn("Failed to parse bytes into a data packet");
+    }
+  }
+
+  /**
+   * Process any data to receive and clear the input buffer; to mock incoming
+   * Data packets, add data to the buffer with respondWith().
+   *
+   * @throws IOException For I/O error.
+   * @throws EncodingException For invalid encoding.
+   */
+  @Override
+  public void processEvents() throws IOException, EncodingException {
+    if (!getIsConnected()) {
+      logger.warn("Not connnected, aborting...");
+      return;
+    }
+
+    // pass data up to face
+    inputBuffer.limit(inputBuffer.capacity());
+    inputBuffer.position(0);
+    elementReader.onReceivedData(inputBuffer);
+
+    // reset buffer
+    inputBuffer = ByteBuffer.allocate(BUFFER_CAPACITY);
+  }
+
+  /**
+   * Check if the transport is connected.
+   *
+   * @return true if connected.
+   */
+  @Override
+  public boolean getIsConnected() {
+    return connected;
+  }
+
+  /**
+   * Close the connection.
+   *
+   * @throws IOException For I/O error.
+   */
+  @Override
+  public void close() throws IOException {
+    logger.debug("Closing...");
+    connected = false;
+  }
+}
diff --git a/src/main/resources/log4j2-test.xml b/src/main/resources/log4j2-test.xml
new file mode 100644
index 0000000..9e29cc3
--- /dev/null
+++ b/src/main/resources/log4j2-test.xml
@@ -0,0 +1,13 @@
+<?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="trace">
+      <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
new file mode 100644
index 0000000..8f7a167
--- /dev/null
+++ b/src/main/resources/log4j2.xml
@@ -0,0 +1,13 @@
+<?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="error">
+      <AppenderRef ref="Console"/>
+    </Root>
+  </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/src/test/java/com/intel/jndn/mock/MockTransportTest.java b/src/test/java/com/intel/jndn/mock/MockTransportTest.java
new file mode 100644
index 0000000..137717f
--- /dev/null
+++ b/src/test/java/com/intel/jndn/mock/MockTransportTest.java
@@ -0,0 +1,133 @@
+/*
+ * File name: MockTransportTest.java
+ * 
+ * Purpose: Test the MockTransport
+ * 
+ * © Copyright Intel Corporation. All rights reserved.
+ * Intel Corporation, 2200 Mission College Boulevard,
+ * Santa Clara, CA 95052-8119, USA
+ */
+package com.intel.jndn.mock;
+
+import java.io.IOException;
+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.OnData;
+import net.named_data.jndn.OnInterest;
+import net.named_data.jndn.OnRegisterFailed;
+import net.named_data.jndn.encoding.EncodingException;
+import net.named_data.jndn.security.SecurityException;
+import net.named_data.jndn.transport.Transport;
+import net.named_data.jndn.util.Blob;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * Mock the transport class Example: ...
+ *
+ * @author Andrew Brown <andrew.brown@intel.com>
+ */
+public class MockTransportTest {
+
+  /**
+   * Setup logging
+   */
+  private static final Logger logger = LogManager.getLogger();
+
+  /**
+   * Test of getSentBuffer method, of class MockTransport.
+   * @throws java.io.IOException
+   * @throws net.named_data.jndn.encoding.EncodingException
+   */
+  @Test
+  public void testGetSentBuffer() throws IOException, EncodingException {
+    MockTransport transport = new MockTransport();
+    Face face = new Face(transport, null);
+
+    // setup return data
+    Data response = new Data(new Name("/a/b/c"));
+    response.setContent(new Blob("..."));
+    transport.respondWith(response);
+
+    // express interest on the face
+    final Counter count = new Counter();
+    face.expressInterest(new Interest(new Name("/a/b/c")), new OnData() {
+      @Override
+      public void onData(Interest interest, Data data) {
+        count.inc();
+        logger.debug("Received data");
+        assertEquals(data.getContent().buf(), new Blob("...").buf());
+      }
+    });
+    
+    while(count.get() == 0){
+      face.processEvents();
+    }
+  }
+  
+  class Counter{
+    int count = 0;
+    public void inc(){
+      count++;
+    }
+    public int get(){
+      return count;
+    }
+  }
+
+  /**
+   * Test of getSentBuffer method, of class MockTransport.
+   */
+//  @Test
+//  public void testGetSentBuffer() {
+//    MockTransport transport = new MockTransport();
+//    Face face = new Face(transport, null);
+//
+//    // setup return data
+//    int typeCode = 101;
+//    int[] tlvBytes = new int[]{1, 200};
+//
+//    // register prefix
+//    try {
+//      Name prefix = new Name("/a/b/c");
+//      logger.info("Registering prefix: " + prefix.toUri());
+//      long id = face.registerPrefix(prefix, new TestOnInterest(), new TestOnRegisterFailed());
+//      assertTrue(id > 0);
+//    } catch (IOException | SecurityException e) {
+//      fail("Failed to register prefix.");
+//    }
+//  }
+//  class TestOnData implements OnData {
+//
+//    @Override
+//    public void onData(Interest interest, Data data) {
+//      assertEquals(data.getName(), new Name("/a/b/c"));
+//      assertEquals(data.getContent(), new Blob("..."));
+//    }
+//  }
+  class TestOnInterest implements OnInterest {
+
+    @Override
+    public void onInterest(Name prefix, Interest interest, Transport transport, long registeredPrefixId) {
+      Data data = new Data(interest.getName());
+      data.setContent(new Blob("..."));
+      try {
+        transport.send(data.wireEncode().buf());
+      } catch (IOException e) {
+        fail("Failed to send packet.");
+      }
+    }
+  }
+
+  class TestOnRegisterFailed implements OnRegisterFailed {
+
+    @Override
+    public void onRegisterFailed(Name prefix) {
+      fail("Failed to register prefix.");
+    }
+  }
+}