Merge "BUG-3849: Unit test failure due to timing issues"
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / connection / ConnectionManagerImpl.java
index 7f16e813b80fcde8cb4cb119e586fa1a7d67c252..907afb6c0d88cd0b0b85204963e785b358c93631 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
+ * <p/>
  * 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
@@ -39,7 +39,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
 
     private static final Logger LOG = LoggerFactory.getLogger(ConnectionManagerImpl.class);
     private static final int HELLO_LIMIT = 20;
-    private boolean bitmapNegotiationEnabled = true;
+    private final boolean bitmapNegotiationEnabled = true;
     private DeviceConnectedHandler deviceConnectedHandler;
 
     @Override
@@ -60,6 +60,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
         LOG.trace("prepare handshake context");
         HandshakeContext handshakeContext = new HandshakeContextImpl(handshakePool, handshakeManager);
         handshakeListener.setHandshakeContext(handshakeContext);
+        connectionContext.setHandshakeContext(handshakeContext);
 
         LOG.trace("prepare connection listeners");
         final ConnectionReadyListener connectionReadyListener = new ConnectionReadyListenerImpl(
@@ -70,7 +71,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
                 new OpenflowProtocolListenerInitialImpl(connectionContext, handshakeContext);
         connectionAdapter.setMessageListener(ofMessageListener);
 
-        final SystemNotificationsListener systemListener = new SystemNotificationsListenerImpl(connectionContext, handshakeContext);
+        final SystemNotificationsListener systemListener = new SystemNotificationsListenerImpl(connectionContext);
         connectionAdapter.setSystemListener(systemListener);
 
         LOG.trace("connection ballet finished");
@@ -94,7 +95,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
      * @return
      */
     private HandshakeManager createHandshakeManager(final ConnectionAdapter connectionAdapter,
-            final HandshakeListener handshakeListener) {
+                                                    final HandshakeListener handshakeListener) {
         HandshakeManagerImpl handshakeManager = new HandshakeManagerImpl(connectionAdapter,
                 ConnectionConductor.versionOrder.get(0),
                 ConnectionConductor.versionOrder);
@@ -109,7 +110,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
      * @return parameter dedicated to hello message content
      */
     public boolean isBitmapNegotiationEnabled() {
-        return bitmapNegotiationEnabled ;
+        return bitmapNegotiationEnabled;
     }