Merge "Fixed bug in cross-broker RPC routing"
[controller.git] / opendaylight / netconf / netconf-impl / src / main / java / org / opendaylight / controller / netconf / impl / NetconfServerDispatcher.java
index c73840132f67856b296de749cbe60a961a6a2023..4f60788975fb910f5ae29a4fbac35b8f28d4fe08 100644 (file)
@@ -8,31 +8,26 @@
 
 package org.opendaylight.controller.netconf.impl;
 
-import com.google.common.base.Optional;
 import io.netty.channel.ChannelFuture;
+import io.netty.channel.EventLoopGroup;
 import io.netty.channel.socket.SocketChannel;
 import io.netty.util.concurrent.Promise;
+import java.net.InetSocketAddress;
 import org.opendaylight.controller.netconf.api.NetconfSession;
 import org.opendaylight.controller.netconf.impl.util.DeserializerExceptionHandler;
-import org.opendaylight.controller.netconf.util.AbstractSslChannelInitializer;
+import org.opendaylight.controller.netconf.util.AbstractChannelInitializer;
 import org.opendaylight.protocol.framework.AbstractDispatcher;
 
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLEngine;
-import java.net.InetSocketAddress;
-
 public class NetconfServerDispatcher extends AbstractDispatcher<NetconfSession, NetconfServerSessionListener> {
 
-    private final ServerSslChannelInitializer initializer;
+    private final ServerChannelInitializer initializer;
 
-    public NetconfServerDispatcher(final Optional<SSLContext> maybeContext,
-            NetconfServerSessionNegotiatorFactory serverNegotiatorFactory,
-            NetconfServerSessionListenerFactory listenerFactory) {
-        this.initializer = new ServerSslChannelInitializer(maybeContext, serverNegotiatorFactory, listenerFactory);
+    public NetconfServerDispatcher(ServerChannelInitializer serverChannelInitializer, EventLoopGroup bossGroup,
+            EventLoopGroup workerGroup) {
+        super(bossGroup, workerGroup);
+        this.initializer = serverChannelInitializer;
     }
 
-    // FIXME change headers for all new source code files
-
     // TODO test create server with same address twice
     public ChannelFuture createServer(InetSocketAddress address) {
 
@@ -44,15 +39,13 @@ public class NetconfServerDispatcher extends AbstractDispatcher<NetconfSession,
         });
     }
 
-    private static class ServerSslChannelInitializer extends AbstractSslChannelInitializer {
+    public static class ServerChannelInitializer extends AbstractChannelInitializer {
 
         private final NetconfServerSessionNegotiatorFactory negotiatorFactory;
         private final NetconfServerSessionListenerFactory listenerFactory;
 
-        private ServerSslChannelInitializer(Optional<SSLContext> maybeContext,
-                                            NetconfServerSessionNegotiatorFactory negotiatorFactory,
+        public ServerChannelInitializer(NetconfServerSessionNegotiatorFactory negotiatorFactory,
                                             NetconfServerSessionListenerFactory listenerFactory) {
-            super(maybeContext);
             this.negotiatorFactory = negotiatorFactory;
             this.listenerFactory = listenerFactory;
         }
@@ -63,10 +56,6 @@ public class NetconfServerDispatcher extends AbstractDispatcher<NetconfSession,
             ch.pipeline().addLast("negotiator", negotiatorFactory.getSessionNegotiator(listenerFactory, ch, promise));
         }
 
-        @Override
-        protected void initSslEngine(SSLEngine sslEngine) {
-            sslEngine.setUseClientMode(false);
-        }
     }
 
 }