Improve the resiliency of the packet deserialization code.

Packet deserializers now check for malformed input while reading the byte
stream. Deserializers are re-implemented as functions that take a byte array
and return a packet object. The old IPacket.deserialize(...) methods have been
deprecated with the goal of eventually moving to immutable packet objects.
Unit tests have been implemented for all Deserializer functions.

ONOS-1589

Change-Id: I9073d5e6e7991e15d43830cfd810989256b71c56
diff --git a/utils/misc/src/test/java/org/onlab/packet/ndp/NeighborSolicitationTest.java b/utils/misc/src/test/java/org/onlab/packet/ndp/NeighborSolicitationTest.java
index 09e0117..2571b7a 100644
--- a/utils/misc/src/test/java/org/onlab/packet/ndp/NeighborSolicitationTest.java
+++ b/utils/misc/src/test/java/org/onlab/packet/ndp/NeighborSolicitationTest.java
@@ -17,6 +17,8 @@
 
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.onlab.packet.DeserializationException;
+import org.onlab.packet.Deserializer;
 import org.onlab.packet.MacAddress;
 
 import static org.hamcrest.Matchers.is;
@@ -46,6 +48,9 @@
 
     private static byte[] bytePacket;
 
+    private Deserializer<NeighborSolicitation> deserializer
+            = NeighborSolicitation.deserializer();
+
     @BeforeClass
     public static void setUpBeforeClass() throws Exception {
         byte[] byteHeader = {
@@ -78,9 +83,8 @@
      * Tests deserialize and getters.
      */
     @Test
-    public void testDeserialize() {
-        NeighborSolicitation ns = new NeighborSolicitation();
-        ns.deserialize(bytePacket, 0, bytePacket.length);
+    public void testDeserialize() throws DeserializationException {
+        NeighborSolicitation ns = deserializer.deserialize(bytePacket, 0, bytePacket.length);
 
         assertArrayEquals(ns.getTargetAddress(), TARGET_ADDRESS);