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;
public class ConcurrentClientsTest {
private static final int CONCURRENCY = 16;
- public static final NetconfClientDispatcher NETCONF_CLIENT_DISPATCHER = new NetconfClientDispatcher(Optional.<SSLContext>absent());
+ private static EventLoopGroup nettyGroup = new NioEventLoopGroup();
+ public static final NetconfClientDispatcher NETCONF_CLIENT_DISPATCHER = new NetconfClientDispatcher(
+ Optional.<SSLContext> absent(), nettyGroup, nettyGroup);
+
@Mock
private YangStoreService yangStoreService;
@Mock
private DefaultCommitNotificationProducer commitNot;
private NetconfServerDispatcher dispatch;
+
@Before
public void setUp() throws Exception {
{ // init mocks
NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory(
factoriesListener, commitNot, idProvider);
- dispatch = new NetconfServerDispatcher(Optional.<SSLContext> absent(), serverNegotiatorFactory, listenerFactory);
+ NetconfServerDispatcher.ServerSslChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerSslChannelInitializer(
+ Optional.<SSLContext> absent(), serverNegotiatorFactory, listenerFactory);
+ dispatch = new NetconfServerDispatcher(serverChannelInitializer, nettyGroup, nettyGroup);
ChannelFuture s = dispatch.createServer(netconfAddress);
s.await();
@AfterClass
public static void tearDownStatic() {
- NETCONF_CLIENT_DISPATCHER.close();
+ nettyGroup.shutdownGracefully();
}
private NetconfOperationServiceFactory mockOpF() {
@After
public void cleanUp() throws Exception {
commitNot.close();
- dispatch.close();
}
@Test