use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class UdpChannelTest method shouldGetProtocolFamilyForIpV4.
@Test
public void shouldGetProtocolFamilyForIpV4() throws Exception {
final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?endpoint=127.0.0.1:12345|interface=127.0.0.1");
assertThat(udpChannel.protocolFamily(), is((ProtocolFamily) StandardProtocolFamily.INET));
}
use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class UdpChannelTest method shouldHandleCanonicalFormForMulticastWithLocalPort.
@Test
public void shouldHandleCanonicalFormForMulticastWithLocalPort() throws Exception {
final UdpChannel udpChannelLocalPort = UdpChannel.parse("aeron:udp?interface=127.0.0.1:40455|endpoint=224.0.1.1:40456");
assertThat(udpChannelLocalPort.canonicalForm(), is("UDP-7f000001-40455-e0000101-40456"));
final UdpChannel udpChannelSubnetLocalPort = UdpChannel.parse("aeron:udp?interface=127.0.0.0:40455/24|endpoint=224.0.1.1:40456");
assertThat(udpChannelSubnetLocalPort.canonicalForm(), is("UDP-7f000001-40455-e0000101-40456"));
}
use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class UdpChannelTest method shouldHandleExplicitLocalAddressAndPortFormat.
@Test
public void shouldHandleExplicitLocalAddressAndPortFormat() throws Exception {
final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?interface=localhost:40123|endpoint=localhost:40124");
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 shouldHandleIPv6AnyAddressAsInterfaceAddressForUnicast.
@Theory
public void shouldHandleIPv6AnyAddressAsInterfaceAddressForUnicast(@Values({ "endpoint" }) final String endpointKey, @Values({ "interface" }) final String interfaceKey) throws Exception {
final UdpChannel udpChannel = UdpChannel.parse(uri(endpointKey, "[::1]:40124", interfaceKey, "[::]"));
assertThat(udpChannel.localData(), is(new InetSocketAddress("::", 0)));
assertThat(udpChannel.localControl(), is(new InetSocketAddress("::", 0)));
assertThat(udpChannel.remoteData(), is(new InetSocketAddress("::1", 40124)));
assertThat(udpChannel.remoteControl(), is(new InetSocketAddress("::1", 40124)));
}
use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class UdpChannelTest method shouldHandleCanonicalFormForUnicastCorrectlyWithAeronUri.
@Theory
public void shouldHandleCanonicalFormForUnicastCorrectlyWithAeronUri(@Values({ "endpoint" }) final String endpointKey, @Values({ "interface" }) final String interfaceKey) throws Exception {
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-00000000-0-c0a80001-40456"));
assertThat(udpChannelLocal.canonicalForm(), is("UDP-7f000001-0-c0a80001-40456"));
assertThat(udpChannelLocalPort.canonicalForm(), is("UDP-7f000001-40455-c0a80001-40456"));
assertThat(udpChannelLocalhost.canonicalForm(), is("UDP-7f000001-0-7f000001-40456"));
}
Aggregations