From 39ff0e7188f56f5c639cf81c2402db4c5dc85772 Mon Sep 17 00:00:00 2001 From: Maros Marsalek Date: Tue, 12 Nov 2013 14:09:08 +0100 Subject: [PATCH] Exctract EventLoopGroup instances to constructorparameters for netconf client and server dispatcher Change-Id: I6edd9d3eda371bc427fae178bc445dee2dc3169b Signed-off-by: Maros Marsalek --- .../netconf/config-persister-impl/pom.xml | 3 ++ .../ConfigPersisterNotificationHandler.java | 11 ++++-- .../client/NetconfClientDispatcher.java | 4 +- .../client/NetconfSshClientDispatcher.java | 7 +++- opendaylight/netconf/netconf-impl/pom.xml | 1 + .../netconf/impl/NetconfServerDispatcher.java | 15 ++++--- .../impl/osgi/NetconfImplActivator.java | 14 +++++-- .../netconf/impl/ConcurrentClientsTest.java | 15 +++++-- .../impl/NetconfDispatcherImplTest.java | 39 +++++++++++++------ .../netconf/it/NetconfITSecureTest.java | 16 ++++++-- .../controller/netconf/it/NetconfITTest.java | 31 ++++++++------- 11 files changed, 105 insertions(+), 51 deletions(-) diff --git a/opendaylight/netconf/config-persister-impl/pom.xml b/opendaylight/netconf/config-persister-impl/pom.xml index 85592e5aa2..21ecd31339 100644 --- a/opendaylight/netconf/config-persister-impl/pom.xml +++ b/opendaylight/netconf/config-persister-impl/pom.xml @@ -78,6 +78,9 @@ org.opendaylight.controller.netconf.client, org.opendaylight.controller.netconf.util.osgi, org.opendaylight.controller.netconf.util.xml, + io.netty.channel, + io.netty.channel.nio, + io.netty.util.concurrent, org.osgi.framework, org.slf4j, org.w3c.dom, diff --git a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandler.java b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandler.java index d390161aff..a20e00bcff 100644 --- a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandler.java +++ b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandler.java @@ -11,6 +11,8 @@ package org.opendaylight.controller.netconf.persist.impl; import com.google.common.base.Optional; import com.google.common.base.Preconditions; import com.google.common.collect.Sets; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; import org.opendaylight.controller.config.persist.api.Persister; import org.opendaylight.controller.netconf.api.NetconfMessage; import org.opendaylight.controller.netconf.api.jmx.CommitJMXNotification; @@ -53,6 +55,7 @@ public class ConfigPersisterNotificationHandler implements NotificationListener, private final InetSocketAddress address; private final NetconfClientDispatcher dispatcher; + private final EventLoopGroup nettyThreadgroup; private NetconfClient netconfClient; @@ -76,7 +79,9 @@ public class ConfigPersisterNotificationHandler implements NotificationListener, this.address = address; this.mbeanServer = mbeanServer; this.timeout = timeout; - this.dispatcher = new NetconfClientDispatcher(Optional.absent()); + + this.nettyThreadgroup = new NioEventLoopGroup(); + this.dispatcher = new NetconfClientDispatcher(Optional.absent(), nettyThreadgroup, nettyThreadgroup); } public void init() throws InterruptedException { @@ -314,9 +319,9 @@ public class ConfigPersisterNotificationHandler implements NotificationListener, } try { - dispatcher.close(); + nettyThreadgroup.shutdownGracefully(); } catch (Exception e) { - logger.warn("Unable to close netconf client dispatcher {}", dispatcher, e); + logger.warn("Unable to close netconf client thread group {}", dispatcher, e); } // unregister from JMX diff --git a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientDispatcher.java b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientDispatcher.java index d18f0208d4..6fc4da026f 100644 --- a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientDispatcher.java +++ b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientDispatcher.java @@ -10,6 +10,7 @@ package org.opendaylight.controller.netconf.client; import com.google.common.base.Optional; import com.google.common.base.Preconditions; +import io.netty.channel.EventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.util.HashedWheelTimer; import io.netty.util.concurrent.Future; @@ -32,7 +33,8 @@ public class NetconfClientDispatcher extends AbstractDispatcher maybeContext; private final NetconfClientSessionNegotiatorFactory negotatorFactory; - public NetconfClientDispatcher(final Optional maybeContext) { + public NetconfClientDispatcher(final Optional maybeContext, EventLoopGroup bossGroup, EventLoopGroup workerGroup) { + super(bossGroup, workerGroup); this.maybeContext = Preconditions.checkNotNull(maybeContext); this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(new HashedWheelTimer()); } diff --git a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfSshClientDispatcher.java b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfSshClientDispatcher.java index a426181183..ce0f427475 100644 --- a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfSshClientDispatcher.java +++ b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfSshClientDispatcher.java @@ -8,8 +8,11 @@ package org.opendaylight.controller.netconf.client; +import io.netty.channel.EventLoopGroup; + public class NetconfSshClientDispatcher extends NetconfClientDispatcher { - public NetconfSshClientDispatcher() { - super(null); + + public NetconfSshClientDispatcher(EventLoopGroup bossGroup, EventLoopGroup workerGroup) { + super(null, bossGroup, workerGroup); } } diff --git a/opendaylight/netconf/netconf-impl/pom.xml b/opendaylight/netconf/netconf-impl/pom.xml index 33fa675a92..f1e3f891ee 100644 --- a/opendaylight/netconf/netconf-impl/pom.xml +++ b/opendaylight/netconf/netconf-impl/pom.xml @@ -111,6 +111,7 @@ io.netty.util.concurrent, io.netty.buffer, io.netty.handler.codec, + io.netty.channel.nio, javax.management, javax.net.ssl, javax.xml.namespace, diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerDispatcher.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerDispatcher.java index c73840132f..882d368a1a 100644 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerDispatcher.java +++ b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerDispatcher.java @@ -10,6 +10,7 @@ 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 org.opendaylight.controller.netconf.api.NetconfSession; @@ -25,14 +26,12 @@ public class NetconfServerDispatcher extends AbstractDispatcher maybeContext, - NetconfServerSessionNegotiatorFactory serverNegotiatorFactory, - NetconfServerSessionListenerFactory listenerFactory) { - this.initializer = new ServerSslChannelInitializer(maybeContext, serverNegotiatorFactory, listenerFactory); + public NetconfServerDispatcher(ServerSslChannelInitializer 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,12 +43,12 @@ public class NetconfServerDispatcher extends AbstractDispatcher maybeContext, + public ServerSslChannelInitializer(Optional maybeContext, NetconfServerSessionNegotiatorFactory negotiatorFactory, NetconfServerSessionListenerFactory listenerFactory) { super(maybeContext); diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfImplActivator.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfImplActivator.java index fc240f91c9..1a4888ba93 100644 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfImplActivator.java +++ b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfImplActivator.java @@ -8,6 +8,7 @@ package org.opendaylight.controller.netconf.impl.osgi; import com.google.common.base.Optional; +import io.netty.channel.nio.NioEventLoopGroup; import io.netty.util.HashedWheelTimer; import org.opendaylight.controller.netconf.impl.DefaultCommitNotificationProducer; import org.opendaylight.controller.netconf.impl.NetconfServerDispatcher; @@ -35,6 +36,7 @@ public class NetconfImplActivator implements BundleActivator { private NetconfOperationServiceFactoryTracker factoriesTracker; private DefaultCommitNotificationProducer commitNot; private NetconfServerDispatcher dispatch; + private NioEventLoopGroup eventLoopGroup; @Override public void start(final BundleContext context) throws Exception { @@ -56,10 +58,14 @@ public class NetconfImplActivator implements BundleActivator { NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory( factoriesListener, commitNot, idProvider); + eventLoopGroup = new NioEventLoopGroup(); + if (maybeTCPAddress.isPresent()) { Optional maybeSSLContext = Optional.absent(); InetSocketAddress address = maybeTCPAddress.get(); - dispatch = new NetconfServerDispatcher(maybeSSLContext, serverNegotiatorFactory, listenerFactory); + NetconfServerDispatcher.ServerSslChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerSslChannelInitializer( + maybeSSLContext, serverNegotiatorFactory, listenerFactory); + dispatch = new NetconfServerDispatcher(serverChannelInitializer, eventLoopGroup, eventLoopGroup); logger.info("Starting TCP netconf server at {}", address); dispatch.createServer(address); @@ -67,7 +73,9 @@ public class NetconfImplActivator implements BundleActivator { if (maybeTLSConfiguration.isPresent()) { Optional maybeSSLContext = Optional.of(maybeTLSConfiguration.get().getSslContext()); InetSocketAddress address = maybeTLSConfiguration.get().getAddress(); - dispatch = new NetconfServerDispatcher(maybeSSLContext, serverNegotiatorFactory, listenerFactory); + NetconfServerDispatcher.ServerSslChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerSslChannelInitializer( + maybeSSLContext, serverNegotiatorFactory, listenerFactory); + dispatch = new NetconfServerDispatcher(serverChannelInitializer, eventLoopGroup, eventLoopGroup); logger.info("Starting TLS netconf server at {}", address); dispatch.createServer(address); @@ -79,6 +87,6 @@ public class NetconfImplActivator implements BundleActivator { logger.info("Shutting down netconf because YangStoreService service was removed"); commitNot.close(); - dispatch.close(); + eventLoopGroup.shutdownGracefully(); } } diff --git a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ConcurrentClientsTest.java b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ConcurrentClientsTest.java index 1295149c02..b363976aae 100644 --- a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ConcurrentClientsTest.java +++ b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ConcurrentClientsTest.java @@ -11,6 +11,8 @@ package org.opendaylight.controller.netconf.impl; import com.google.common.base.Optional; import com.google.common.collect.Sets; import io.netty.channel.ChannelFuture; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; import io.netty.util.HashedWheelTimer; import org.apache.commons.io.IOUtils; import org.junit.After; @@ -64,7 +66,10 @@ import static org.mockito.Mockito.mock; public class ConcurrentClientsTest { private static final int CONCURRENCY = 16; - public static final NetconfClientDispatcher NETCONF_CLIENT_DISPATCHER = new NetconfClientDispatcher(Optional.absent()); + private static EventLoopGroup nettyGroup = new NioEventLoopGroup(); + public static final NetconfClientDispatcher NETCONF_CLIENT_DISPATCHER = new NetconfClientDispatcher( + Optional. absent(), nettyGroup, nettyGroup); + @Mock private YangStoreService yangStoreService; @Mock @@ -77,6 +82,7 @@ public class ConcurrentClientsTest { private DefaultCommitNotificationProducer commitNot; private NetconfServerDispatcher dispatch; + @Before public void setUp() throws Exception { { // init mocks @@ -103,7 +109,9 @@ public class ConcurrentClientsTest { NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory( factoriesListener, commitNot, idProvider); - dispatch = new NetconfServerDispatcher(Optional. absent(), serverNegotiatorFactory, listenerFactory); + NetconfServerDispatcher.ServerSslChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerSslChannelInitializer( + Optional. absent(), serverNegotiatorFactory, listenerFactory); + dispatch = new NetconfServerDispatcher(serverChannelInitializer, nettyGroup, nettyGroup); ChannelFuture s = dispatch.createServer(netconfAddress); s.await(); @@ -111,7 +119,7 @@ public class ConcurrentClientsTest { @AfterClass public static void tearDownStatic() { - NETCONF_CLIENT_DISPATCHER.close(); + nettyGroup.shutdownGracefully(); } private NetconfOperationServiceFactory mockOpF() { @@ -160,7 +168,6 @@ public class ConcurrentClientsTest { @After public void cleanUp() throws Exception { commitNot.close(); - dispatch.close(); } @Test diff --git a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfDispatcherImplTest.java b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfDispatcherImplTest.java index 233fffda02..e43febec79 100644 --- a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfDispatcherImplTest.java +++ b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfDispatcherImplTest.java @@ -8,22 +8,35 @@ package org.opendaylight.controller.netconf.impl; -import java.lang.management.ManagementFactory; -import java.net.InetSocketAddress; - -import javax.net.ssl.SSLContext; - +import com.google.common.base.Optional; +import io.netty.channel.ChannelFuture; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.util.HashedWheelTimer; +import org.junit.After; +import org.junit.Before; import org.junit.Test; import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListener; import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListenerImpl; -import com.google.common.base.Optional; - -import io.netty.channel.ChannelFuture; -import io.netty.util.HashedWheelTimer; +import javax.net.ssl.SSLContext; +import java.lang.management.ManagementFactory; +import java.net.InetSocketAddress; public class NetconfDispatcherImplTest { + private EventLoopGroup nettyGroup; + + @Before + public void setUp() throws Exception { + nettyGroup = new NioEventLoopGroup(); + } + + @After + public void tearDown() throws Exception { + nettyGroup.shutdownGracefully(); + } + @Test public void test() throws Exception { @@ -37,13 +50,15 @@ public class NetconfDispatcherImplTest { NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory( factoriesListener, commitNot, idProvider); - NetconfServerDispatcher dispatch = new NetconfServerDispatcher(Optional. absent(), - serverNegotiatorFactory, listenerFactory); + NetconfServerDispatcher.ServerSslChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerSslChannelInitializer(Optional.absent(), serverNegotiatorFactory, listenerFactory); + + + NetconfServerDispatcher dispatch = new NetconfServerDispatcher( + serverChannelInitializer, nettyGroup, nettyGroup); InetSocketAddress addr = new InetSocketAddress("127.0.0.1", 8333); ChannelFuture s = dispatch.createServer(addr); commitNot.close(); - dispatch.close(); } } diff --git a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITSecureTest.java b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITSecureTest.java index 9a4bc2aa5d..0c22a71c6b 100644 --- a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITSecureTest.java +++ b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITSecureTest.java @@ -10,6 +10,8 @@ package org.opendaylight.controller.netconf.it; import com.google.common.base.Optional; import io.netty.channel.ChannelFuture; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; import io.netty.util.HashedWheelTimer; import org.junit.After; import org.junit.Before; @@ -51,6 +53,8 @@ public class NetconfITSecureTest extends AbstractConfigTest { private DefaultCommitNotificationProducer commitNot; private NetconfServerDispatcher dispatchS; + private EventLoopGroup nettyThreadgroup; + @Before public void setUp() throws Exception { @@ -62,6 +66,8 @@ public class NetconfITSecureTest extends AbstractConfigTest { commitNot = new DefaultCommitNotificationProducer(ManagementFactory.getPlatformMBeanServer()); + nettyThreadgroup = new NioEventLoopGroup(); + dispatchS = createDispatcher(Optional.of(getSslContext()), factoriesListener); ChannelFuture s = dispatchS.createServer(tlsAddress); s.await(); @@ -76,13 +82,15 @@ public class NetconfITSecureTest extends AbstractConfigTest { NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory( factoriesListener, commitNot, idProvider); - return new NetconfServerDispatcher(sslC, serverNegotiatorFactory, listenerFactory); + NetconfServerDispatcher.ServerSslChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerSslChannelInitializer( + sslC, serverNegotiatorFactory, listenerFactory); + return new NetconfServerDispatcher(serverChannelInitializer, nettyThreadgroup, nettyThreadgroup); } @After public void tearDown() throws Exception { commitNot.close(); - dispatchS.close(); + nettyThreadgroup.shutdownGracefully(); } private SSLContext getSslContext() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, @@ -106,8 +114,8 @@ public class NetconfITSecureTest extends AbstractConfigTest { @Test public void testSecure() throws Exception { - try (NetconfClientDispatcher dispatch = new NetconfClientDispatcher(Optional.of(getSslContext())); - NetconfClient netconfClient = new NetconfClient("tls-client", tlsAddress, 4000, dispatch)) { + NetconfClientDispatcher dispatch = new NetconfClientDispatcher(Optional.of(getSslContext()), nettyThreadgroup, nettyThreadgroup); + try (NetconfClient netconfClient = new NetconfClient("tls-client", tlsAddress, 4000, dispatch)) { } } diff --git a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java index e9fe857bca..403ba3d0fc 100644 --- a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java +++ b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java @@ -12,9 +12,10 @@ import com.google.common.base.Optional; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import io.netty.channel.ChannelFuture; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; import io.netty.util.HashedWheelTimer; import org.junit.After; -import org.junit.AfterClass; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; @@ -90,8 +91,9 @@ public class NetconfITTest extends AbstractConfigTest { closeSession, startExi, stopExi; private DefaultCommitNotificationProducer commitNot; private NetconfServerDispatcher dispatch; + private EventLoopGroup nettyThreadgroup; - private static NetconfClientDispatcher NETCONF_CLIENT_DISPATCHER = new NetconfClientDispatcher(Optional.absent()); + private NetconfClientDispatcher clientDispatcher; @Before public void setUp() throws Exception { @@ -103,11 +105,15 @@ public class NetconfITTest extends AbstractConfigTest { NetconfOperationServiceFactoryListenerImpl factoriesListener = new NetconfOperationServiceFactoryListenerImpl(); factoriesListener.onAddNetconfOperationServiceFactory(new NetconfOperationServiceFactoryImpl(getYangStore())); + nettyThreadgroup = new NioEventLoopGroup(); + commitNot = new DefaultCommitNotificationProducer(ManagementFactory.getPlatformMBeanServer()); dispatch = createDispatcher(Optional. absent(), factoriesListener); ChannelFuture s = dispatch.createServer(tcpAddress); s.await(); + + clientDispatcher = new NetconfClientDispatcher(Optional.absent(), nettyThreadgroup, nettyThreadgroup); } private NetconfServerDispatcher createDispatcher(Optional sslC, @@ -119,18 +125,15 @@ public class NetconfITTest extends AbstractConfigTest { NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory( factoriesListener, commitNot, idProvider); - return new NetconfServerDispatcher(sslC, serverNegotiatorFactory, listenerFactory); + NetconfServerDispatcher.ServerSslChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerSslChannelInitializer( + sslC, serverNegotiatorFactory, listenerFactory); + return new NetconfServerDispatcher(serverChannelInitializer, nettyThreadgroup, nettyThreadgroup); } @After public void tearDown() throws Exception { commitNot.close(); - dispatch.close(); - } - - @AfterClass - public static void tearDownStatic() { - NETCONF_CLIENT_DISPATCHER.close(); + nettyThreadgroup.shutdownGracefully(); } private void loadMessages() throws IOException, SAXException, ParserConfigurationException { @@ -171,7 +174,7 @@ public class NetconfITTest extends AbstractConfigTest { @Test public void testNetconfClientDemonstration() throws Exception { - try (NetconfClient netconfClient = new NetconfClient("client", tcpAddress, 4000, NETCONF_CLIENT_DISPATCHER)) { + try (NetconfClient netconfClient = new NetconfClient("client", tcpAddress, 4000, clientDispatcher)) { Set capabilitiesFromNetconfServer = netconfClient.getCapabilities(); long sessionId = netconfClient.getSessionId(); @@ -186,8 +189,8 @@ public class NetconfITTest extends AbstractConfigTest { @Test public void testTwoSessions() throws Exception { - try (NetconfClient netconfClient = new NetconfClient("1", tcpAddress, 4000, NETCONF_CLIENT_DISPATCHER)) { - try (NetconfClient netconfClient2 = new NetconfClient("2", tcpAddress, 4000, NETCONF_CLIENT_DISPATCHER)) { + try (NetconfClient netconfClient = new NetconfClient("1", tcpAddress, 4000, clientDispatcher)) { + try (NetconfClient netconfClient2 = new NetconfClient("2", tcpAddress, 4000, clientDispatcher)) { } } } @@ -387,7 +390,7 @@ public class NetconfITTest extends AbstractConfigTest { // final InputStream resourceAsStream = // AbstractListenerTest.class.getResourceAsStream(fileName); // assertNotNull(resourceAsStream); - try (NetconfClient netconfClient = new NetconfClient("test", tcpAddress, 5000, NETCONF_CLIENT_DISPATCHER)) { + try (NetconfClient netconfClient = new NetconfClient("test", tcpAddress, 5000, clientDispatcher)) { // IOUtils.copy(resourceAsStream, netconfClient.getStream()); // netconfClient.getOutputStream().write(NetconfMessageFactory.endOfMessage); // server should not write anything back @@ -436,7 +439,7 @@ public class NetconfITTest extends AbstractConfigTest { } private NetconfClient createSession(final InetSocketAddress address, final String expected) throws Exception { - final NetconfClient netconfClient = new NetconfClient("test " + address.toString(), address, 5000, NETCONF_CLIENT_DISPATCHER); + final NetconfClient netconfClient = new NetconfClient("test " + address.toString(), address, 5000, clientDispatcher); assertEquals(expected, Long.toString(netconfClient.getSessionId())); return netconfClient; } -- 2.36.6