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.server;
10 import static org.junit.jupiter.api.Assertions.assertEquals;
11 import static org.junit.jupiter.api.Assertions.assertNotNull;
13 import io.netty.channel.local.LocalAddress;
14 import java.net.InetSocketAddress;
15 import org.junit.jupiter.api.Test;
17 class NetconfServerSessionNegotiatorTest {
20 final var address = new InetSocketAddress(10);
21 final var hostname = NetconfServerSessionNegotiator.getHostName(address);
22 assertNotNull(hostname);
23 assertEquals(address.getHostName(), hostname.getValue());
27 void testPortTwenty() {
28 final var address = new InetSocketAddress("TestPortInet", 20);
29 final var hostname = NetconfServerSessionNegotiator.getHostName(address);
30 assertEquals(address.getHostName(), hostname.getValue());
31 assertEquals(String.valueOf(address.getPort()), hostname.getKey());
35 void testGetInetSocketAddress() {
36 final var address = new LocalAddress("TestPortLocal");
37 final var hostname = NetconfServerSessionNegotiator.getHostName(address);
38 assertEquals(String.valueOf(address.id()), hostname.getValue());