java_gen: pair requests and replies
diff --git a/java_gen/java_model.py b/java_gen/java_model.py
index 944b536..5e5779e 100644
--- a/java_gen/java_model.py
+++ b/java_gen/java_model.py
@@ -268,12 +268,31 @@
         self.constant_name = c_name.upper().replace("OF_", "")
 
         pck_suffix, parent_interface, self.type_annotation = self.class_info()
+
         self.package = "org.openflow.protocol.%s" % pck_suffix if pck_suffix else "org.openflow.protocol"
         if self.name != parent_interface:
             self.parent_interface = parent_interface
         else:
             self.parent_interface = None
 
+    @property
+    @memoize
+    def all_parent_interfaces(self):
+        return [ "OFObject" ] + \
+               ([ self.parent_interface ] if self.parent_interface else [] )+ \
+               self.additional_parent_interfaces
+    @property
+    @memoize
+    def additional_parent_interfaces(self):
+        if loxi_utils.class_is_message(self.c_name) and not self.is_virtual:
+            m = re.match(r'(.*)Request$', self.name)
+            if m:
+                reply_name = m.group(1) + "Reply"
+                if model.interface_by_name(reply_name):
+                    return ["OFRequest<%s>" % reply_name ]
+        return []
+
+
     def is_instance_of(self, other_class):
         if self == other_class:
             return True
@@ -315,9 +334,9 @@
             return ("", "OFStatsReply", None)
         elif re.match(r'OFFlow(Add|Modify(Strict)?|Delete(Strict)?)$', self.name):
             return ("", "OFFlowMod", None)
-        elif loxi_utils.class_is_message(self.c_name) and re.match(r'OFBsn.+$', self.name):
+        elif loxi_utils.class_is_message(self.c_name) and re.match(r'OFBsn.+$', self.name) and self.name != "OFBsnHeader":
             return ("", "OFBsnHeader", None)
-        elif loxi_utils.class_is_message(self.c_name) and re.match(r'OFNicira.+$', self.name):
+        elif loxi_utils.class_is_message(self.c_name) and re.match(r'OFNicira.+$', self.name) and self.name != "OFNiciraHeader":
             return ("", "OFNiciraHeader", None)
         elif re.match(r'OFMatch.*', self.name):
             return ("", "Match", None)
diff --git a/java_gen/templates/of_interface.java b/java_gen/templates/of_interface.java
index 8ddaba3..8c9bf25 100644
--- a/java_gen/templates/of_interface.java
+++ b/java_gen/templates/of_interface.java
@@ -36,7 +36,7 @@
 
 //:: include("_imports.java", msg=msg)
 
-public interface ${msg.name}${ "<%s>" % msg.type_annotation if msg.type_annotation else ""} extends OFObject${", %s" % msg.parent_interface if msg.parent_interface else ""}{
+public interface ${msg.name}${ "<%s>" % msg.type_annotation if msg.type_annotation else ""} extends ${", ".join(msg.all_parent_interfaces)} {
 //:: for prop in msg.members:
     ${prop.java_type.public_type} ${prop.getter_name}()${ "" if prop.is_universal else " throws UnsupportedOperationException"};
 //:: #endfor