Search in sources :

Example 41 with UdpChannel

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

the class UdpChannelTest method shouldGetProtocolFamilyForIpV6.

@Test
public void shouldGetProtocolFamilyForIpV6() {
    assumeTrue(System.getProperty("java.net.preferIPv4Stack") == null);
    final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?endpoint=[::1]:12345|interface=[::1]");
    assertThat(udpChannel.protocolFamily(), is(StandardProtocolFamily.INET6));
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 42 with UdpChannel

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

the class UdpChannelTest method shouldHandleCanonicalFormWithNsLookup.

@Test
public void shouldHandleCanonicalFormWithNsLookup() {
    final UdpChannel udpChannelExampleCom = UdpChannel.parse("aeron:udp?endpoint=localhost:40456");
    assertThat(udpChannelExampleCom.canonicalForm(), is("UDP-0.0.0.0:0-localhost:40456"));
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 43 with UdpChannel

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

the class UdpChannelTest method shouldParseReceiverWindow.

@Test
void shouldParseReceiverWindow() {
    final UdpChannel udpChannelWithBufferSizes = UdpChannel.parse("aeron:udp?endpoint=127.0.0.1:9999|rcv-wnd=8192");
    assertEquals(8192, udpChannelWithBufferSizes.receiverWindowLength());
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 44 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-127.0.0.1:40455-224.0.1.1:40456"));
    final UdpChannel udpChannelSubnetLocalPort = UdpChannel.parse("aeron:udp?interface=127.0.0.0:40455/29|endpoint=224.0.1.1:40456");
    assertThat(udpChannelSubnetLocalPort.canonicalForm(), matchesPattern("UDP-127\\.0\\.0\\.[1-7]:40455-224\\.0\\.1\\.1:40456"));
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 45 with UdpChannel

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

the class UdpChannelTest method shouldHandleIpV6CanonicalFormForMulticastCorrectly.

@ParameterizedTest
@CsvSource("endpoint,interface")
public void shouldHandleIpV6CanonicalFormForMulticastCorrectly(final String endpointKey, final String interfaceKey) {
    assumeTrue(System.getProperty("java.net.preferIPv4Stack") == null);
    final UdpChannel udpChannel = UdpChannel.parse(uri(endpointKey, "[FF01::FD]:40456", interfaceKey, "localhost"));
    final UdpChannel udpChannelLocal = UdpChannel.parse(uri(endpointKey, "224.0.1.1:40456", interfaceKey, "[::1]:54321/64"));
    assertThat(udpChannel.canonicalForm(), is("UDP-127.0.0.1:0-" + udpChannel.remoteData().getHostString() + ":40456"));
    assertThat(udpChannelLocal.canonicalForm(), is("UDP-" + udpChannelLocal.localData().getHostString() + ":54321-224.0.1.1:40456"));
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

UdpChannel (io.aeron.driver.media.UdpChannel)94 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)70 Test (org.junit.jupiter.api.Test)52 CsvSource (org.junit.jupiter.params.provider.CsvSource)22 ReceiveChannelEndpoint (io.aeron.driver.media.ReceiveChannelEndpoint)14 SendChannelEndpoint (io.aeron.driver.media.SendChannelEndpoint)8 ControlProtocolException (io.aeron.exceptions.ControlProtocolException)6 ChannelUri (io.aeron.ChannelUri)4 PublicationParams (io.aeron.driver.PublicationParams)4 ReceiveDestinationTransport (io.aeron.driver.media.ReceiveDestinationTransport)4 Pattern (java.util.regex.Pattern)3 Aeron (io.aeron.Aeron)2 SPY_QUALIFIER (io.aeron.ChannelUri.SPY_QUALIFIER)2 CommonContext (io.aeron.CommonContext)2 FORCE_TRUE (io.aeron.CommonContext.InferableBoolean.FORCE_TRUE)2 INFER (io.aeron.CommonContext.InferableBoolean.INFER)2 ErrorCode (io.aeron.ErrorCode)2 Context (io.aeron.driver.MediaDriver.Context)2 SubscriptionParams.validateInitialWindowForRcvBuf (io.aeron.driver.SubscriptionParams.validateInitialWindowForRcvBuf)2 LogFactory (io.aeron.driver.buffer.LogFactory)2