Merge "Fix checkstyle warnings in yang-test."
[controller.git] / opendaylight / netconf / netconf-impl / src / test / java / org / opendaylight / controller / netconf / impl / NetconfServerSessionNegotiatorTest.java
1 package org.opendaylight.controller.netconf.impl;
2
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertNotNull;
5
6 import io.netty.channel.local.LocalAddress;
7 import java.net.InetSocketAddress;
8 import org.apache.sshd.common.SshdSocketAddress;
9 import org.junit.Test;
10
11 public class NetconfServerSessionNegotiatorTest {
12
13     @Test
14     public void testGetInetSocketAddress() throws Exception {
15
16         InetSocketAddress socketAddress = new InetSocketAddress(10);
17
18         assertNotNull(NetconfServerSessionNegotiator.getHostName(socketAddress));
19
20         assertEquals(socketAddress.getHostName(),
21                 NetconfServerSessionNegotiator.getHostName(socketAddress)
22                         .getValue());
23
24         socketAddress = new InetSocketAddress("TestPortInet", 20);
25
26         assertEquals(socketAddress.getHostName(),
27                 NetconfServerSessionNegotiator.getHostName(socketAddress)
28                         .getValue());
29
30         assertEquals(String.valueOf(socketAddress.getPort()),
31                 NetconfServerSessionNegotiator.getHostName(socketAddress)
32                         .getKey());
33
34         LocalAddress localAddress = new LocalAddress("TestPortLocal");
35
36         assertEquals(String.valueOf(localAddress.id()),
37                 NetconfServerSessionNegotiator.getHostName(localAddress)
38                         .getValue());
39
40         SshdSocketAddress embeddedAddress = new SshdSocketAddress(
41                 "TestSshdName", 10);
42
43     }
44 }