Fix license header violations in netconf
[controller.git] / opendaylight / netconf / netconf-impl / src / test / java / org / opendaylight / controller / netconf / impl / NetconfServerSessionNegotiatorTest.java
1 /*
2  * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.netconf.impl;
10
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotNull;
13
14 import io.netty.channel.local.LocalAddress;
15 import java.net.InetSocketAddress;
16 import org.apache.sshd.common.SshdSocketAddress;
17 import org.junit.Test;
18
19 public class NetconfServerSessionNegotiatorTest {
20
21     @Test
22     public void testGetInetSocketAddress() throws Exception {
23
24         InetSocketAddress socketAddress = new InetSocketAddress(10);
25
26         assertNotNull(NetconfServerSessionNegotiator.getHostName(socketAddress));
27
28         assertEquals(socketAddress.getHostName(),
29                 NetconfServerSessionNegotiator.getHostName(socketAddress)
30                         .getValue());
31
32         socketAddress = new InetSocketAddress("TestPortInet", 20);
33
34         assertEquals(socketAddress.getHostName(),
35                 NetconfServerSessionNegotiator.getHostName(socketAddress)
36                         .getValue());
37
38         assertEquals(String.valueOf(socketAddress.getPort()),
39                 NetconfServerSessionNegotiator.getHostName(socketAddress)
40                         .getKey());
41
42         LocalAddress localAddress = new LocalAddress("TestPortLocal");
43
44         assertEquals(String.valueOf(localAddress.id()),
45                 NetconfServerSessionNegotiator.getHostName(localAddress)
46                         .getValue());
47
48         SshdSocketAddress embeddedAddress = new SshdSocketAddress(
49                 "TestSshdName", 10);
50
51     }
52 }