Also remove blocking call from celanup.
Change-Id: I9663ae8fd8afb605a6713232c518782ec15d431e
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import java.util.concurrent.TimeUnit;
import org.apache.commons.io.IOUtils;
import org.junit.After;
import org.junit.Before;
import org.apache.commons.io.IOUtils;
import org.junit.After;
import org.junit.Before;
public static final String LOOPBACK_ADDRESS = "127.0.0.1";
public static final int SERVER_CONNECTION_TIMEOUT_MILLIS = 5000;
public static final String LOOPBACK_ADDRESS = "127.0.0.1";
public static final int SERVER_CONNECTION_TIMEOUT_MILLIS = 5000;
+ private static final int RESOURCE_TIMEOUT_MINUTES = 2;
static ModuleFactory[] FACTORIES = {new TestImplModuleFactory(),
new DepTestImplModuleFactory(),
static ModuleFactory[] FACTORIES = {new TestImplModuleFactory(),
new DepTestImplModuleFactory(),
} else {
s = dispatch.createServer(((InetSocketAddress) getTcpServerAddress()));
}
} else {
s = dispatch.createServer(((InetSocketAddress) getTcpServerAddress()));
}
+ s.await(RESOURCE_TIMEOUT_MINUTES, TimeUnit.MINUTES);
*/
@After
public void cleanUpNetconf() throws Exception {
*/
@After
public void cleanUpNetconf() throws Exception {
- serverTcpChannel.close().await();
+ serverTcpChannel.close().await(RESOURCE_TIMEOUT_MINUTES, TimeUnit.MINUTES);
- nettyThreadgroup.shutdownGracefully().await();
+ nettyThreadgroup.shutdownGracefully().await(RESOURCE_TIMEOUT_MINUTES, TimeUnit.MINUTES);
}
public NetconfClientConfiguration getClientConfiguration(final InetSocketAddress tcpAddress, final int timeout) {
}
public NetconfClientConfiguration getClientConfiguration(final InetSocketAddress tcpAddress, final int timeout) {
@After
public void tearDown() throws Exception {
sshProxyServer.close();
@After
public void tearDown() throws Exception {
sshProxyServer.close();
- clientGroup.shutdownGracefully().await();
+ clientGroup.shutdownGracefully();
minaTimerEx.shutdownNow();
nioExec.shutdownNow();
}
minaTimerEx.shutdownNow();
nioExec.shutdownNow();
}
+ @Test(timeout = 2*60*1000)
public void testSecure() throws Exception {
final NetconfClientDispatcher dispatch = new NetconfClientDispatcherImpl(getNettyThreadgroup(), getNettyThreadgroup(), getHashedWheelTimer());
try (TestingNetconfClient netconfClient = new TestingNetconfClient("testing-ssh-client", dispatch, getClientConfiguration(new SimpleNetconfClientSessionListener()))) {
public void testSecure() throws Exception {
final NetconfClientDispatcher dispatch = new NetconfClientDispatcherImpl(getNettyThreadgroup(), getNettyThreadgroup(), getHashedWheelTimer());
try (TestingNetconfClient netconfClient = new TestingNetconfClient("testing-ssh-client", dispatch, getClientConfiguration(new SimpleNetconfClientSessionListener()))) {