use of io.aeron.driver.media.UdpChannel in project aeron by real-logic.
the class UdpChannelTest method shouldHandleIpV6CanonicalFormForUnicastCorrectly.
@ParameterizedTest
@CsvSource("endpoint,interface")
public void shouldHandleIpV6CanonicalFormForUnicastCorrectly(final String endpointKey, final String interfaceKey) {
assumeTrue(System.getProperty("java.net.preferIPv4Stack") == null);
final UdpChannel udpChannelLocal = UdpChannel.parse(uri(endpointKey, "192.168.0.1:40456", interfaceKey, "[::1]"));
final UdpChannel udpChannelLocalPort = UdpChannel.parse(uri(endpointKey, "[fe80::5246:5dff:fe73:df06]:40456", interfaceKey, "127.0.0.1:40455"));
assertThat(udpChannelLocal.canonicalForm(), is("UDP-" + udpChannelLocal.localData().getHostString() + ":0-192.168.0.1:40456"));
assertThat(udpChannelLocalPort.canonicalForm(), is("UDP-127.0.0.1:40455-[fe80::5246:5dff:fe73:df06]:40456"));
}
use of io.aeron.driver.media.UdpChannel in project aeron by real-logic.
the class UdpChannelTest method shouldHandleCanonicalFormForUnicastCorrectlyWithAeronUri.
@ParameterizedTest
@CsvSource("endpoint,interface")
public void shouldHandleCanonicalFormForUnicastCorrectlyWithAeronUri(final String endpointKey, final String interfaceKey) {
final UdpChannel udpChannel = UdpChannel.parse(uri(endpointKey, "192.168.0.1:40456"));
final UdpChannel udpChannelLocal = UdpChannel.parse(uri(endpointKey, "192.168.0.1:40456", interfaceKey, "127.0.0.1"));
final UdpChannel udpChannelLocalPort = UdpChannel.parse(uri(endpointKey, "192.168.0.1:40456", interfaceKey, "127.0.0.1:40455"));
final UdpChannel udpChannelLocalhost = UdpChannel.parse(uri(endpointKey, "localhost:40456", interfaceKey, "localhost"));
assertThat(udpChannel.canonicalForm(), is("UDP-0.0.0.0:0-192.168.0.1:40456"));
assertThat(udpChannelLocal.canonicalForm(), is("UDP-127.0.0.1:0-192.168.0.1:40456"));
assertThat(udpChannelLocalPort.canonicalForm(), is("UDP-127.0.0.1:40455-192.168.0.1:40456"));
assertThat(udpChannelLocalhost.canonicalForm(), is("UDP-127.0.0.1:0-localhost:40456"));
}
use of io.aeron.driver.media.UdpChannel in project aeron by real-logic.
the class UdpChannelTest method shouldHandleExplicitLocalControlAddressAndPortFormatIPv6.
@Test
public void shouldHandleExplicitLocalControlAddressAndPortFormatIPv6() {
assumeTrue(System.getProperty("java.net.preferIPv4Stack") == null);
final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?control=[fe80::5246:5dff:fe73:df06]:40124|control-mode=dynamic");
assertThat(udpChannel.localData(), is(new InetSocketAddress("fe80::5246:5dff:fe73:df06", 40124)));
assertThat(udpChannel.localControl(), is(new InetSocketAddress("fe80::5246:5dff:fe73:df06", 40124)));
assertThat(udpChannel.remoteData(), is(new InetSocketAddress("::", 0)));
assertThat(udpChannel.remoteControl(), is(new InetSocketAddress("::", 0)));
}
use of io.aeron.driver.media.UdpChannel in project aeron by real-logic.
the class UdpChannelTest method shouldHandleCanonicalFormForMulticastWithLocalPort.
@Test
public void shouldHandleCanonicalFormForMulticastWithLocalPort() {
final UdpChannel udpChannelLocalPort = UdpChannel.parse("aeron:udp?interface=127.0.0.1:40455|endpoint=224.0.1.1:40456");
assertThat(udpChannelLocalPort.canonicalForm(), is("UDP-127.0.0.1:40455-224.0.1.1:40456"));
final UdpChannel udpChannelSubnetLocalPort = UdpChannel.parse("aeron:udp?interface=127.0.0.0:40455/29|endpoint=224.0.1.1:40456");
assertThat(udpChannelSubnetLocalPort.canonicalForm(), matchesPattern("UDP-127\\.0\\.0\\.[1-7]:40455-224\\.0\\.1\\.1:40456"));
}
use of io.aeron.driver.media.UdpChannel in project aeron by real-logic.
the class UdpChannelTest method shouldHandleImpliedLocalPortFormat.
@Test
public void shouldHandleImpliedLocalPortFormat() {
final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?interface=localhost|endpoint=localhost:40124");
assertThat(udpChannel.localData(), is(new InetSocketAddress("localhost", 0)));
assertThat(udpChannel.localControl(), is(new InetSocketAddress("localhost", 0)));
assertThat(udpChannel.remoteData(), is(new InetSocketAddress("localhost", 40124)));
assertThat(udpChannel.remoteControl(), is(new InetSocketAddress("localhost", 40124)));
}
Aggregations