Search in sources :

Example 1 with NetworkInterfaceBinding

use of org.jboss.as.network.NetworkInterfaceBinding in project wildfly by wildfly.

the class UndertowConnectorTestCase method getAddress.

@Test
public void getAddress() throws UnknownHostException {
    InetAddress expected = InetAddress.getLocalHost();
    NetworkInterfaceBinding interfaceBinding = new NetworkInterfaceBinding(Collections.<NetworkInterface>emptySet(), expected);
    SocketBindingManager bindingManager = mock(SocketBindingManager.class);
    SocketBinding binding = new SocketBinding("socket", 1, true, null, 0, interfaceBinding, bindingManager, Collections.<ClientMapping>emptyList());
    when(this.listener.getSocketBinding()).thenReturn(binding);
    InetAddress result = this.connector.getAddress();
    assertSame(expected, result);
}
Also used : SocketBinding(org.jboss.as.network.SocketBinding) NetworkInterfaceBinding(org.jboss.as.network.NetworkInterfaceBinding) InetAddress(java.net.InetAddress) SocketBindingManager(org.jboss.as.network.SocketBindingManager) Test(org.junit.Test)

Example 2 with NetworkInterfaceBinding

use of org.jboss.as.network.NetworkInterfaceBinding in project wildfly by wildfly.

the class UndertowConnectorTestCase method getPort.

@Test
public void getPort() throws UnknownHostException {
    int expected = 10;
    NetworkInterfaceBinding interfaceBinding = new NetworkInterfaceBinding(Collections.<NetworkInterface>emptySet(), InetAddress.getLocalHost());
    SocketBindingManager bindingManager = mock(SocketBindingManager.class);
    SocketBinding binding = new SocketBinding("socket", expected, true, null, 0, interfaceBinding, bindingManager, Collections.<ClientMapping>emptyList());
    when(this.listener.getSocketBinding()).thenReturn(binding);
    int result = this.connector.getPort();
    assertSame(expected, result);
}
Also used : SocketBinding(org.jboss.as.network.SocketBinding) NetworkInterfaceBinding(org.jboss.as.network.NetworkInterfaceBinding) SocketBindingManager(org.jboss.as.network.SocketBindingManager) Test(org.junit.Test)

Aggregations

NetworkInterfaceBinding (org.jboss.as.network.NetworkInterfaceBinding)2 SocketBinding (org.jboss.as.network.SocketBinding)2 SocketBindingManager (org.jboss.as.network.SocketBindingManager)2 Test (org.junit.Test)2 InetAddress (java.net.InetAddress)1