UDP support implementation
[openflowjava.git] / simple-client / src / main / java / org / opendaylight / openflowjava / protocol / impl / clients / SimpleClientInitializer.java
index eed609702309530310c59568dab1175305911b52..c44a660cd08de933c82a95ac4b5cc647f1d80de0 100644 (file)
@@ -1,23 +1,28 @@
-/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 
 package org.opendaylight.openflowjava.protocol.impl.clients;
 
 import io.netty.channel.ChannelInitializer;
 import io.netty.channel.ChannelPipeline;
-import io.netty.channel.socket.SocketChannel;
+import io.netty.channel.socket.nio.NioSocketChannel;
 import io.netty.handler.ssl.SslHandler;
 
 import javax.net.ssl.SSLEngine;
 
-import org.opendaylight.openflowjava.protocol.impl.core.SslContextFactory;
-
 import com.google.common.util.concurrent.SettableFuture;
 
 /** Initializes secured {@link SimpleClient} pipeline
  * 
  * @author michal.polkorab
  */
-public class SimpleClientInitializer extends ChannelInitializer<SocketChannel> {
+public class SimpleClientInitializer extends ChannelInitializer<NioSocketChannel> {
     
     private SettableFuture<Boolean> isOnlineFuture;
     private boolean secured;
@@ -33,17 +38,17 @@ public class SimpleClientInitializer extends ChannelInitializer<SocketChannel> {
     }
 
     @Override
-    public void initChannel(SocketChannel ch) throws Exception {
+    public void initChannel(NioSocketChannel ch) throws Exception {
         ChannelPipeline pipeline = ch.pipeline();
         if (secured) {
-            SSLEngine engine = SslContextFactory.getClientContext()
+            SSLEngine engine = ClientSslContextFactory.getClientContext()
                     .createSSLEngine();
             engine.setUseClientMode(true);
             pipeline.addLast("ssl", new SslHandler(engine));
-            pipeline.addLast("framer", new SimpleClientFramer());
         }
         SimpleClientHandler simpleClientHandler = new SimpleClientHandler(isOnlineFuture, scenarioHandler);
         simpleClientHandler.setScenario(scenarioHandler);
+        pipeline.addLast("framer", new SimpleClientFramer());
         pipeline.addLast("handler", simpleClientHandler);
         isOnlineFuture = null;