java_gen/GenericReader: BUGFIX version dispatch for hybrid

This commit fixes a bug in OpenFlowJ's GenericReader. GenericReader
previously dispatched to the version specific readers based on
bb.getByte(0). This turns out to be the first *absolute* byte in the
ChannelBuffer, not the first readable byte at the current readerIndex.

I.e., if several messages were queued in the ChannelBuffer, the Generic
Reader would always dispatch according to the version of the first
message.

In standard use, we pin the OF version after we receive the HELLO
from the switch. Hence, this was not a problem observed in practice.

It could cause problems for hybrid mode connections.
diff --git a/java_gen/templates/of_factories.java b/java_gen/templates/of_factories.java
index f9ec015..ba73286 100644
--- a/java_gen/templates/of_factories.java
+++ b/java_gen/templates/of_factories.java
@@ -51,7 +51,9 @@
 
     private static class GenericReader implements OFMessageReader<OFMessage> {
         public OFMessage readFrom(ChannelBuffer bb) throws OFParseError {
-            short wireVersion = U8.f(bb.getByte(0));
+            if(!bb.readable())
+                return null;
+            short wireVersion = U8.f(bb.getByte(bb.readerIndex()));
             OFFactory factory;
             switch (wireVersion) {
             //:: for v in versions: