1 package org.opendaylight.controller.netconf.impl;
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertNotNull;
6 import io.netty.channel.local.LocalAddress;
7 import java.net.InetSocketAddress;
8 import org.apache.sshd.common.SshdSocketAddress;
11 public class NetconfServerSessionNegotiatorTest {
14 public void testGetInetSocketAddress() throws Exception {
16 InetSocketAddress socketAddress = new InetSocketAddress(10);
18 assertNotNull(NetconfServerSessionNegotiator.getHostName(socketAddress));
20 assertEquals(socketAddress.getHostName(),
21 NetconfServerSessionNegotiator.getHostName(socketAddress)
24 socketAddress = new InetSocketAddress("TestPortInet", 20);
26 assertEquals(socketAddress.getHostName(),
27 NetconfServerSessionNegotiator.getHostName(socketAddress)
30 assertEquals(String.valueOf(socketAddress.getPort()),
31 NetconfServerSessionNegotiator.getHostName(socketAddress)
34 LocalAddress localAddress = new LocalAddress("TestPortLocal");
36 assertEquals(String.valueOf(localAddress.id()),
37 NetconfServerSessionNegotiator.getHostName(localAddress)
40 SshdSocketAddress embeddedAddress = new SshdSocketAddress(