2 * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.netconf.impl;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
13 import io.netty.channel.local.LocalAddress;
14 import java.net.InetSocketAddress;
15 import org.junit.Test;
16 import org.opendaylight.netconf.shaded.sshd.common.util.net.SshdSocketAddress;
18 public class NetconfServerSessionNegotiatorTest {
20 public void testGetInetSocketAddress() throws Exception {
22 InetSocketAddress socketAddress = new InetSocketAddress(10);
24 assertNotNull(NetconfServerSessionNegotiator.getHostName(socketAddress));
26 assertEquals(socketAddress.getHostName(),
27 NetconfServerSessionNegotiator.getHostName(socketAddress)
30 socketAddress = new InetSocketAddress("TestPortInet", 20);
32 assertEquals(socketAddress.getHostName(),
33 NetconfServerSessionNegotiator.getHostName(socketAddress)
36 assertEquals(String.valueOf(socketAddress.getPort()),
37 NetconfServerSessionNegotiator.getHostName(socketAddress)
40 LocalAddress localAddress = new LocalAddress("TestPortLocal");
42 assertEquals(String.valueOf(localAddress.id()),
43 NetconfServerSessionNegotiator.getHostName(localAddress)
46 SshdSocketAddress embeddedAddress = new SshdSocketAddress(