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
9 package org.opendaylight.netconf.impl;
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotNull;
14 import io.netty.channel.local.LocalAddress;
15 import java.net.InetSocketAddress;
16 import org.apache.sshd.common.util.net.SshdSocketAddress;
17 import org.junit.Test;
19 public class NetconfServerSessionNegotiatorTest {
22 public void testGetInetSocketAddress() throws Exception {
24 InetSocketAddress socketAddress = new InetSocketAddress(10);
26 assertNotNull(NetconfServerSessionNegotiator.getHostName(socketAddress));
28 assertEquals(socketAddress.getHostName(),
29 NetconfServerSessionNegotiator.getHostName(socketAddress)
32 socketAddress = new InetSocketAddress("TestPortInet", 20);
34 assertEquals(socketAddress.getHostName(),
35 NetconfServerSessionNegotiator.getHostName(socketAddress)
38 assertEquals(String.valueOf(socketAddress.getPort()),
39 NetconfServerSessionNegotiator.getHostName(socketAddress)
42 LocalAddress localAddress = new LocalAddress("TestPortLocal");
44 assertEquals(String.valueOf(localAddress.id()),
45 NetconfServerSessionNegotiator.getHostName(localAddress)
48 SshdSocketAddress embeddedAddress = new SshdSocketAddress(