2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.netconf.netty;
11 import static org.mockito.Matchers.anyString;
12 import static org.mockito.Mockito.doReturn;
13 import static org.mockito.Mockito.mock;
15 import io.netty.channel.nio.NioEventLoopGroup;
16 import org.junit.Test;
17 import org.opendaylight.controller.netconf.ssh.NetconfSSHServer;
18 import org.opendaylight.controller.netconf.ssh.authentication.AuthProvider;
19 import org.opendaylight.controller.netconf.ssh.authentication.PEMGenerator;
20 import org.opendaylight.controller.netconf.util.osgi.NetconfConfigUtil;
21 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory;
24 public class SSHTest {
25 public static final Logger logger = LoggerFactory.getLogger(SSHTest.class);
28 public void test() throws Exception {
29 new Thread(new EchoServer(), "EchoServer").start();
30 AuthProvider authProvider = mock(AuthProvider.class);
31 doReturn(PEMGenerator.generate().toCharArray()).when(authProvider).getPEMAsCharArray();
32 doReturn(true).when(authProvider).authenticated(anyString(), anyString());
33 NetconfSSHServer thread = NetconfSSHServer.start(1831, NetconfConfigUtil.getNetconfLocalAddress(), authProvider, new NioEventLoopGroup());
35 logger.info("Closing socket");