X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2FNetconfServerSessionNegotiatorTest.java;fp=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2FNetconfServerSessionNegotiatorTest.java;h=c16046c64236b098bb3f98e9353db89e796abd00;hb=c22efb3a8955c6562f95915b69fbdbf1ff4e4f11;hp=0000000000000000000000000000000000000000;hpb=dd32d3d246ebad8b7c76afb93239a4462f329a6b;p=controller.git diff --git a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiatorTest.java b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiatorTest.java new file mode 100644 index 0000000000..c16046c642 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiatorTest.java @@ -0,0 +1,45 @@ +package org.opendaylight.controller.netconf.impl; + +import io.netty.channel.local.LocalAddress; +import org.apache.sshd.common.SshdSocketAddress; +import org.junit.Test; + +import java.net.InetSocketAddress; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class NetconfServerSessionNegotiatorTest { + + @Test + public void testGetInetSocketAddress() throws Exception { + + InetSocketAddress socketAddress = new InetSocketAddress(10); + + assertNotNull(NetconfServerSessionNegotiator.getHostName(socketAddress)); + + assertEquals(socketAddress.getHostName(), + NetconfServerSessionNegotiator.getHostName(socketAddress) + .getValue()); + + socketAddress = new InetSocketAddress("TestPortInet", 20); + + assertEquals(socketAddress.getHostName(), + NetconfServerSessionNegotiator.getHostName(socketAddress) + .getValue()); + + assertEquals(String.valueOf(socketAddress.getPort()), + NetconfServerSessionNegotiator.getHostName(socketAddress) + .getKey()); + + LocalAddress localAddress = new LocalAddress("TestPortLocal"); + + assertEquals(String.valueOf(localAddress.id()), + NetconfServerSessionNegotiator.getHostName(localAddress) + .getValue()); + + SshdSocketAddress embeddedAddress = new SshdSocketAddress( + "TestSshdName", 10); + + } +} \ No newline at end of file