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 io.netty.channel.local.LocalAddress;
4 import org.apache.sshd.common.SshdSocketAddress;
5 import org.junit.Test;
6
7 import java.net.InetSocketAddress;
8
9 import static org.junit.Assert.assertEquals;
10 import static org.junit.Assert.assertNotNull;
11
12 public class NetconfServerSessionNegotiatorTest {
13
14     @Test
15     public void testGetInetSocketAddress() throws Exception {
16
17         InetSocketAddress socketAddress = new InetSocketAddress(10);
18
19         assertNotNull(NetconfServerSessionNegotiator.getHostName(socketAddress));
20
21         assertEquals(socketAddress.getHostName(),
22                 NetconfServerSessionNegotiator.getHostName(socketAddress)
23                         .getValue());
24
25         socketAddress = new InetSocketAddress("TestPortInet", 20);
26
27         assertEquals(socketAddress.getHostName(),
28                 NetconfServerSessionNegotiator.getHostName(socketAddress)
29                         .getValue());
30
31         assertEquals(String.valueOf(socketAddress.getPort()),
32                 NetconfServerSessionNegotiator.getHostName(socketAddress)
33                         .getKey());
34
35         LocalAddress localAddress = new LocalAddress("TestPortLocal");
36
37         assertEquals(String.valueOf(localAddress.id()),
38                 NetconfServerSessionNegotiator.getHostName(localAddress)
39                         .getValue());
40
41         SshdSocketAddress embeddedAddress = new SshdSocketAddress(
42                 "TestSshdName", 10);
43
44     }
45 }