Search in sources :

Example 26 with UdpChannel

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)));
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) Test(org.junit.Test)

Example 27 with UdpChannel

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)));
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) Theory(org.junit.experimental.theories.Theory)

Example 28 with UdpChannel

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());
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) Test(org.junit.Test)

Example 29 with UdpChannel

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)));
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) Theory(org.junit.experimental.theories.Theory)

Example 30 with UdpChannel

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)));
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) Test(org.junit.Test)

Aggregations

UdpChannel (io.aeron.driver.media.UdpChannel)31 Test (org.junit.Test)16 Theory (org.junit.experimental.theories.Theory)11 ReceiveChannelEndpoint (io.aeron.driver.media.ReceiveChannelEndpoint)6 SendChannelEndpoint (io.aeron.driver.media.SendChannelEndpoint)4 RawLog (io.aeron.driver.buffer.RawLog)1 AeronUri (io.aeron.driver.uri.AeronUri)1 HashMap (java.util.HashMap)1