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) {
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"));
}
use of io.aeron.driver.media.UdpChannel in project aeron by real-logic.
the class UdpChannelTest method shouldHandleImpliedLocalPortFormatWithAeronUri.
@Theory
public void shouldHandleImpliedLocalPortFormatWithAeronUri(@Values({ "endpoint" }) final String endpointKey, @Values({ "interface" }) final String interfaceKey) {
final UdpChannel udpChannel = UdpChannel.parse(uri(endpointKey, "localhost:40124", interfaceKey, "localhost"));
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)));
}
use of io.aeron.driver.media.UdpChannel in project aeron by real-logic.
the class UdpChannelTest method shouldHandleIpV6CanonicalFormForUnicastCorrectly.
@Theory
public void shouldHandleIpV6CanonicalFormForUnicastCorrectly(@Values({ "endpoint" }) final String endpointKey, @Values({ "interface" }) final String interfaceKey) {
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-00000000000000000000000000000001-0-c0a80001-40456"));
assertThat(udpChannelLocalPort.canonicalForm(), is("UDP-7f000001-40455-fe8000000000000052465dfffe73df06-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)));
}
use of io.aeron.driver.media.UdpChannel in project aeron by real-logic.
the class UdpChannelTest method shouldParseValidMulticastAddress.
@Test
public void shouldParseValidMulticastAddress() throws Exception {
final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?interface=localhost|endpoint=224.10.9.9:40124");
assertThat(udpChannel.localControl(), is(new InetSocketAddress("localhost", 0)));
assertThat(udpChannel.remoteControl(), isMulticastAddress("224.10.9.10", 40124));
assertThat(udpChannel.localData(), is(new InetSocketAddress("localhost", 0)));
assertThat(udpChannel.remoteData(), isMulticastAddress("224.10.9.9", 40124));
assertThat(udpChannel.localInterface(), is(NetworkInterface.getByInetAddress(InetAddress.getByName("localhost"))));
}
Aggregations