Fix buffer handling; decrease logger verbosity
diff --git a/src/main/java/com/intel/jndn/mock/MockTransport.java b/src/main/java/com/intel/jndn/mock/MockTransport.java
index ee9c4e3..f8ed15e 100644
--- a/src/main/java/com/intel/jndn/mock/MockTransport.java
+++ b/src/main/java/com/intel/jndn/mock/MockTransport.java
@@ -13,6 +13,7 @@
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import net.named_data.jndn.Data;
 import net.named_data.jndn.encoding.ElementListener;
@@ -47,15 +48,15 @@
   }
 
   /**
-   * 
+   *
    */
   public void clear() {
     throw new UnsupportedOperationException("Not supported yet.");
   }
 
   /**
-   * 
-   * @return 
+   *
+   * @return
    */
   public List<Data> getSentDataPackets() {
     return outputPackets;
@@ -113,7 +114,7 @@
   @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();
@@ -142,11 +143,15 @@
       return;
     }
 
+    logger.trace(String.format("Sending buffer (position: %s, limit: %s, capacity: %s): %s", inputBuffer.position(), inputBuffer.limit(), inputBuffer.capacity(), Arrays.toString(inputBuffer.array())));
+
     // pass data up to face
-    inputBuffer.limit(inputBuffer.capacity());
+    inputBuffer.limit(inputBuffer.position());
     inputBuffer.position(0);
     elementReader.onReceivedData(inputBuffer);
 
+    logger.trace(String.format("Sending buffer (position: %s, limit: %s, capacity: %s): %s", inputBuffer.position(), inputBuffer.limit(), inputBuffer.capacity(), Arrays.toString(inputBuffer.array())));
+
     // reset buffer
     inputBuffer = ByteBuffer.allocate(BUFFER_CAPACITY);
   }
diff --git a/src/main/resources/log4j2-test.xml b/src/main/resources/log4j2-test.xml
index 9e29cc3..602b5ab 100644
--- a/src/main/resources/log4j2-test.xml
+++ b/src/main/resources/log4j2-test.xml
@@ -6,7 +6,7 @@
     </Console>
   </Appenders>
   <Loggers>
-    <Root level="trace">
+    <Root level="info">
       <AppenderRef ref="Console"/>
     </Root>
   </Loggers>
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index 8f7a167..0dac33a 100644
--- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml
@@ -6,7 +6,7 @@
     </Console>
   </Appenders>
   <Loggers>
-    <Root level="error">
+    <Root level="warn">
       <AppenderRef ref="Console"/>
     </Root>
   </Loggers>
diff --git a/src/test/java/com/intel/jndn/mock/MockTransportTest.java b/src/test/java/com/intel/jndn/mock/MockTransportTest.java
index bf5afd1..300c081 100644
--- a/src/test/java/com/intel/jndn/mock/MockTransportTest.java
+++ b/src/test/java/com/intel/jndn/mock/MockTransportTest.java
@@ -15,6 +15,7 @@
 import net.named_data.jndn.Interest;
 import net.named_data.jndn.Name;
 import net.named_data.jndn.OnData;
+import net.named_data.jndn.OnTimeout;
 import net.named_data.jndn.encoding.EncodingException;
 import net.named_data.jndn.util.Blob;
 import org.apache.logging.log4j.LogManager;
@@ -65,6 +66,65 @@
     }
   }
   
+  
+  /**
+   * Test sending multiple Datas
+   * @throws java.io.IOException
+   * @throws net.named_data.jndn.encoding.EncodingException
+   */
+  @Test
+  public void testSendMultipleData() throws IOException, EncodingException {
+    MockTransport transport = new MockTransport();
+    Face face = new Face(transport, null);
+
+    // setup return data
+    Data response1 = new Data(new Name("/a/b/c/1"));
+    response1.setContent(new Blob("..."));
+    transport.respondWith(response1);
+    Data response2 = new Data(new Name("/a/b/c/2"));
+    response2.setContent(new Blob("..."));
+    transport.respondWith(response2);
+
+    // express interest on the face
+    final Counter count = new Counter();
+    face.expressInterest(new Interest(new Name("/a/b/c/1")), 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();
+    }
+    
+    // express interest again, but this time it should time out because there 
+    // is no data left on the wire; the first processEvents() has already 
+    // picked it up
+    final Counter count2 = new Counter();
+    Interest failingInterest = new Interest(new Name("/a/b/c/2"));
+    failingInterest.setInterestLifetimeMilliseconds(50);
+    face.expressInterest(failingInterest, new OnData() {
+      @Override
+      public void onData(Interest interest, Data data) {
+        count2.inc();
+        fail("Should not return data; data should already be cleared");
+      }
+    }, new OnTimeout(){
+      @Override
+      public void onTimeout(Interest interest) {
+        count2.inc();
+        assertTrue(true);
+      }
+    });
+    
+    while(count2.get() == 0){
+      face.processEvents();
+    }
+  }
+  
   /**
    * Count reference
    */