Search in sources :

Example 56 with UdpChannel

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

the class UdpChannelTest method shouldHandleExplicitLocalAddressAndPortFormat.

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

Example 57 with UdpChannel

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

the class StaticWindowCongestionControlTest method shouldSetWindowLengthFromChannel.

@Test
void shouldSetWindowLengthFromChannel() {
    final UdpChannel channelWithWindow = UdpChannel.parse("aeron:udp?endpoint=127.0.0.1:9999|rcv-wnd=8192");
    final MediaDriver.Context context = new MediaDriver.Context().initialWindowLength(16536);
    final int termLength = 1_000_000;
    final StaticWindowCongestionControl staticWindowCongestionControl = new StaticWindowCongestionControl(0, channelWithWindow, 0, 0, termLength, 0, null, null, null, context, null);
    assertEquals(8192, staticWindowCongestionControl.initialWindowLength());
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) Test(org.junit.jupiter.api.Test)

Example 58 with UdpChannel

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

the class UdpChannelTest method shouldHandleIpV6CanonicalFormForUnicastCorrectly.

@ParameterizedTest
@CsvSource("endpoint,interface")
public void shouldHandleIpV6CanonicalFormForUnicastCorrectly(final String endpointKey, final String interfaceKey) {
    assumeTrue(System.getProperty("java.net.preferIPv4Stack") == null);
    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-" + udpChannelLocal.localData().getHostString() + ":0-192.168.0.1:40456"));
    assertThat(udpChannelLocalPort.canonicalForm(), is("UDP-127.0.0.1:40455-[fe80::5246:5dff:fe73:df06]:40456"));
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 59 with UdpChannel

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

the class UdpChannelTest method shouldGetProtocolFamilyForIpV6WithoutLocalSpecified.

@Test
public void shouldGetProtocolFamilyForIpV6WithoutLocalSpecified() {
    assumeTrue(System.getProperty("java.net.preferIPv4Stack") == null);
    final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?endpoint=[::1]:12345");
    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 60 with UdpChannel

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

the class UdpChannelTest method shouldHandleLocalhostLookupWithAeronUri.

@ParameterizedTest
@ValueSource(strings = "endpoint")
public void shouldHandleLocalhostLookupWithAeronUri(final String endpointKey) {
    final UdpChannel udpChannel = UdpChannel.parse(uri(endpointKey, "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) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

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