import static org.mockito.Mockito.lenient;
import static org.opendaylight.netconf.server.NetconfServerSessionNegotiatorFactory.DEFAULT_BASE_CAPABILITIES;
-import io.netty.util.HashedWheelTimer;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.opendaylight.netconf.client.NetconfMessageUtil;
import org.opendaylight.netconf.client.SimpleNetconfClientSessionListener;
import org.opendaylight.netconf.client.conf.NetconfClientConfigurationBuilder;
+import org.opendaylight.netconf.common.impl.DefaultNetconfTimer;
import org.opendaylight.netconf.nettyutil.handler.exi.NetconfStartExiMessageProvider;
import org.opendaylight.netconf.server.api.SessionIdProvider;
import org.opendaylight.netconf.server.api.monitoring.Capability;
private static int serverPort;
private static TcpServerGrouping serverParams;
private static TcpClientGrouping clientParams;
+ private static DefaultNetconfTimer timer;
private static NetconfMessage getConfigMessage;
private static NetconfMessage clientHelloMessage;
- private HashedWheelTimer hashedWheelTimer;
private BootstrapFactory serverBootstrapFactory;
private NetconfClientFactory clientFactory;
private TCPServer server;
@BeforeAll
public static void beforeAll() throws Exception {
+ timer = new DefaultNetconfTimer();
clientExecutor = Executors.newFixedThreadPool(CONCURRENCY, new ThreadFactory() {
int index = 1;
@AfterAll
static void afterAll() {
clientExecutor.shutdownNow();
- }
-
- @BeforeEach
- void beforeEach() {
- hashedWheelTimer = new HashedWheelTimer();
+ timer.close();
}
void startServer(final int threads, final Set<String> serverCapabilities) throws Exception {
serverBootstrapFactory = new BootstrapFactory("server", threads);
server = TCPServer.listen(new ServerTransportInitializer(NetconfServerSessionNegotiatorFactory.builder()
- .setTimer(hashedWheelTimer)
+ .setTimer(timer)
.setAggregatedOpService(factoriesListener)
.setIdProvider(ID_PROVIDER)
.setConnectionTimeoutMillis(TIMEOUT)
@AfterEach
void afterEach() throws Exception {
- hashedWheelTimer.stop();
server.shutdown().get(TIMEOUT, MILLISECONDS);
serverBootstrapFactory.close();
if (clientFactory != null) {
startServer(threads, serverCaps);
clientFactory = clientClass == NetconfClientRunnable.class
- ? new NetconfClientFactoryImpl(new SSHTransportStackFactory("client", threads)) : null;
+ ? new NetconfClientFactoryImpl(timer, new SSHTransportStackFactory("client", threads)) : null;
final var futures = new ArrayList<Future<?>>(CONCURRENCY);
for (int i = 0; i < CONCURRENCY; i++) {