Search in sources :

Example 46 with UdpChannel

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

Example 47 with UdpChannel

use of io.aeron.driver.media.UdpChannel in project aeron by real-logic.

the class UdpChannelTest method shouldHandleCanonicalFormForMulticastWithLocalPort.

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

Example 48 with UdpChannel

use of io.aeron.driver.media.UdpChannel in project aeron by real-logic.

the class UdpChannelTest method shouldHandleBeingUsedAsMapKey.

@Test
public void shouldHandleBeingUsedAsMapKey() {
    final UdpChannel udpChannel1 = UdpChannel.parse("aeron:udp?endpoint=localhost:40124");
    final UdpChannel udpChannel2 = UdpChannel.parse("aeron:udp?endpoint=localhost:40124");
    final Map<UdpChannel, Integer> map = new HashMap<>();
    map.put(udpChannel1, 1);
    assertThat(map.get(udpChannel2), is(1));
}
Also used : HashMap(java.util.HashMap) UdpChannel(io.aeron.driver.media.UdpChannel) Test(org.junit.Test)

Example 49 with UdpChannel

use of io.aeron.driver.media.UdpChannel in project aeron by real-logic.

the class UdpChannelTest method shouldHandleCanonicalFormWithNsLookup.

@Test
public void shouldHandleCanonicalFormWithNsLookup() throws Exception {
    final String localhostIpAsHex = resolveToHexAddress("localhost");
    final UdpChannel udpChannelExampleCom = UdpChannel.parse("aeron:udp?endpoint=localhost:40456");
    assertThat(udpChannelExampleCom.canonicalForm(), is("UDP-00000000-0-" + localhostIpAsHex + "-40456"));
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) Test(org.junit.Test)

Example 50 with UdpChannel

use of io.aeron.driver.media.UdpChannel in project aeron by real-logic.

the class UdpChannelTest method shouldHandleExplicitLocalAddressAndPortFormatWithAeronUri.

@Theory
public void shouldHandleExplicitLocalAddressAndPortFormatWithAeronUri(@Values({ "endpoint" }) final String endpointKey, @Values({ "interface" }) 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)));
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) Theory(org.junit.experimental.theories.Theory)

Aggregations

UdpChannel (io.aeron.driver.media.UdpChannel)78 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)35 Test (org.junit.jupiter.api.Test)26 Test (org.junit.Test)18 ReceiveChannelEndpoint (io.aeron.driver.media.ReceiveChannelEndpoint)12 Theory (org.junit.experimental.theories.Theory)11 CsvSource (org.junit.jupiter.params.provider.CsvSource)11 SendChannelEndpoint (io.aeron.driver.media.SendChannelEndpoint)7 ChannelUri (io.aeron.ChannelUri)3 PublicationParams (io.aeron.driver.PublicationParams)3 ControlProtocolException (io.aeron.exceptions.ControlProtocolException)3 RawLog (io.aeron.driver.buffer.RawLog)2 ReceiveDestinationTransport (io.aeron.driver.media.ReceiveDestinationTransport)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Pattern (java.util.regex.Pattern)2 Aeron (io.aeron.Aeron)1 SPY_QUALIFIER (io.aeron.ChannelUri.SPY_QUALIFIER)1 ChannelUriStringBuilder (io.aeron.ChannelUriStringBuilder)1 CommonContext (io.aeron.CommonContext)1