Reworked Netconf framing mechanism, added chunked framing mechanism.
[controller.git] / opendaylight / netconf / netconf-util / src / main / java / org / opendaylight / controller / netconf / util / AbstractChannelInitializer.java
index 317a126bbae392c46b8bd699f8023a03f858d4d0..5d082c92cda6c59a86fdd557206cb6817a4d4f6e 100644 (file)
@@ -13,6 +13,9 @@ import javax.net.ssl.SSLEngine;
 
 import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.api.NetconfSession;
+import org.opendaylight.controller.netconf.util.handler.FramingMechanismHandlerFactory;
+import org.opendaylight.controller.netconf.util.handler.NetconfMessageAggregator;
+import org.opendaylight.controller.netconf.util.messages.FramingMechanism;
 import org.opendaylight.controller.netconf.util.messages.NetconfMessageFactory;
 import org.opendaylight.protocol.framework.ProtocolHandlerFactory;
 import org.opendaylight.protocol.framework.ProtocolMessageDecoder;
@@ -40,9 +43,10 @@ public abstract class AbstractChannelInitializer {
             initSsl(ch);
         }
 
-        ch.pipeline().addLast("frameDecoder", NetconfMessageFactory.getDelimiterFrameDecoder());
+        ch.pipeline().addLast("aggregator", new NetconfMessageAggregator(FramingMechanism.EOM));
         ch.pipeline().addLast(handlerFactory.getDecoders());
         initializeAfterDecoder(ch, promise);
+        ch.pipeline().addLast("frameEncoder", FramingMechanismHandlerFactory.createHandler(FramingMechanism.EOM));
         ch.pipeline().addLast(handlerFactory.getEncoders());
     }