use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class UdpChannelTest method shouldHandleExplicitLocalAddressAndPortFormatWithAeronUri.
@ParameterizedTest
@CsvSource("endpoint,interface")
public void shouldHandleExplicitLocalAddressAndPortFormatWithAeronUri(final String endpointKey, final String interfaceKey) {
final UdpChannel udpChannel = UdpChannel.parse(uri(endpointKey, "localhost:40124", interfaceKey, "localhost:40123"));
assertThat(udpChannel.localData(), is(new InetSocketAddress("localhost", 40123)));
assertThat(udpChannel.localControl(), is(new InetSocketAddress("localhost", 40123)));
assertThat(udpChannel.remoteData(), is(new InetSocketAddress("localhost", 40124)));
assertThat(udpChannel.remoteControl(), is(new InetSocketAddress("localhost", 40124)));
}
use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class UdpChannelTest method shouldHandleCanonicalFormForUnicastCorrectly.
@Test
public void shouldHandleCanonicalFormForUnicastCorrectly() {
final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?endpoint=192.168.0.1:40456");
final UdpChannel udpChannelLocal = UdpChannel.parse("aeron:udp?interface=127.0.0.1|endpoint=192.168.0.1:40456");
final UdpChannel udpChannelLocalPort = UdpChannel.parse("aeron:udp?interface=127.0.0.1:40455|endpoint=192.168.0.1:40456");
final UdpChannel udpChannelLocalhost = UdpChannel.parse("aeron:udp?interface=localhost|endpoint=localhost:40456");
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 shouldHandleImpliedLocalAddressAndPortFormatWithAeronUri.
@ParameterizedTest
@CsvSource("endpoint,interface")
public void shouldHandleImpliedLocalAddressAndPortFormatWithAeronUri(final String endpointKey) {
final UdpChannel udpChannel = UdpChannel.parse(uri(endpointKey, "localhost:40124"));
assertThat(udpChannel.localData(), is(new InetSocketAddress("0.0.0.0", 0)));
assertThat(udpChannel.localControl(), is(new InetSocketAddress("0.0.0.0", 0)));
assertThat(udpChannel.remoteData(), is(new InetSocketAddress("localhost", 40124)));
assertThat(udpChannel.remoteControl(), is(new InetSocketAddress("localhost", 40124)));
}
use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class UdpChannelTest method shouldHandleCanonicalFormForMulticastCorrectly.
@Test
public void shouldHandleCanonicalFormForMulticastCorrectly() {
final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?interface=localhost|endpoint=224.0.1.1:40456");
final UdpChannel udpChannelLocal = UdpChannel.parse("aeron:udp?interface=127.0.0.1|endpoint=224.0.1.1:40456");
final UdpChannel udpChannelAllSystems = UdpChannel.parse("aeron:udp?interface=localhost|endpoint=224.0.1.1:40456");
final UdpChannel udpChannelDefault = UdpChannel.parse("aeron:udp?endpoint=224.0.1.1:40456");
final UdpChannel udpChannelSubnet = UdpChannel.parse("aeron:udp?interface=localhost/29|endpoint=224.0.1.1:40456");
final UdpChannel udpChannelSubnetLocal = UdpChannel.parse("aeron:udp?interface=127.0.0.0/29|endpoint=224.0.1.1:40456");
assertThat(udpChannel.canonicalForm(), is("UDP-127.0.0.1:0-224.0.1.1:40456"));
assertThat(udpChannelLocal.canonicalForm(), is("UDP-127.0.0.1:0-224.0.1.1:40456"));
final Pattern canonicalFormPattern = Pattern.compile("UDP-127\\.0\\.0\\.[1-7]:0-224\\.0\\.1\\.1:40456");
assertThat(udpChannelAllSystems.canonicalForm(), matchesPattern(canonicalFormPattern));
assertThat(udpChannelSubnet.canonicalForm(), matchesPattern(canonicalFormPattern));
assertThat(udpChannelSubnetLocal.canonicalForm(), matchesPattern(canonicalFormPattern));
assertThat(udpChannelDefault.localInterface(), supportsMulticastOrIsLoopback());
}
use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class UdpChannelTest method shouldHandleIPv4AnyAddressAsInterfaceAddressForUnicast.
@ParameterizedTest
@CsvSource("endpoint,interface")
public void shouldHandleIPv4AnyAddressAsInterfaceAddressForUnicast(final String endpointKey, final String interfaceKey) {
final UdpChannel udpChannel = UdpChannel.parse(uri(endpointKey, "localhost:40124", interfaceKey, "0.0.0.0"));
assertThat(udpChannel.localData(), is(new InetSocketAddress("0.0.0.0", 0)));
assertThat(udpChannel.localControl(), is(new InetSocketAddress("0.0.0.0", 0)));
assertThat(udpChannel.remoteData(), is(new InetSocketAddress("localhost", 40124)));
assertThat(udpChannel.remoteControl(), is(new InetSocketAddress("localhost", 40124)));
}
Aggregations