use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class UdpChannelTest method shouldHandleImpliedLocalAddressAndPortFormat.
@Test
public void shouldHandleImpliedLocalAddressAndPortFormat() throws Exception {
final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?endpoint=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 shouldHandleIPv4AnyAddressAsInterfaceAddressForUnicast.
@Theory
public void shouldHandleIPv4AnyAddressAsInterfaceAddressForUnicast(@Values({ "endpoint" }) final String endpointKey, @Values({ "interface" }) final String interfaceKey) throws Exception {
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)));
}
use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class UdpChannelTest method shouldHandleCanonicalFormForMulticastCorrectly.
@Test
public void shouldHandleCanonicalFormForMulticastCorrectly() throws Exception {
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.0.1:40456");
final UdpChannel udpChannelDefault = UdpChannel.parse("aeron:udp?endpoint=224.0.1.1:40456");
final UdpChannel udpChannelSubnet = UdpChannel.parse("aeron:udp?interface=localhost/24|endpoint=224.0.1.1:40456");
final UdpChannel udpChannelSubnetLocal = UdpChannel.parse("aeron:udp?interface=127.0.0.0/24|endpoint=224.0.1.1:40456");
assertThat(udpChannel.canonicalForm(), is("UDP-7f000001-0-e0000101-40456"));
assertThat(udpChannelLocal.canonicalForm(), is("UDP-7f000001-0-e0000101-40456"));
assertThat(udpChannelAllSystems.canonicalForm(), is("UDP-7f000001-0-e0000001-40456"));
assertThat(udpChannelSubnet.canonicalForm(), is("UDP-7f000001-0-e0000101-40456"));
assertThat(udpChannelSubnetLocal.canonicalForm(), is("UDP-7f000001-0-e0000101-40456"));
assertThat(udpChannelDefault.localInterface(), supportsMulticastOrIsLoopback());
}
use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class UdpChannelTest method shouldHandleImpliedLocalAddressAndPortFormatWithAeronUri.
@Theory
public void shouldHandleImpliedLocalAddressAndPortFormatWithAeronUri(@Values({ "endpoint" }) final String endpointKey) throws Exception {
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 shouldHandleLocalhostLookup.
@Test
public void shouldHandleLocalhostLookup() throws Exception {
final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?endpoint=localhost:40124");
assertThat(udpChannel.remoteData(), is(new InetSocketAddress("127.0.0.1", 40124)));
assertThat(udpChannel.remoteControl(), is(new InetSocketAddress("127.0.0.1", 40124)));
}
Aggregations