Search in sources :

Example 66 with UdpChannel

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

the class UdpChannelTest method shouldParseChannelSendAndReceiveTimestampOffsets.

@Test
void shouldParseChannelSendAndReceiveTimestampOffsets() {
    final UdpChannel channel = UdpChannel.parse("aeron:udp?endpoint=localhost:0|channel-rcv-ts-offset=reserved|channel-snd-ts-offset=8");
    assertEquals(UdpChannel.RESERVED_VALUE_MESSAGE_OFFSET, channel.channelReceiveTimestampOffset());
    assertEquals(8, channel.channelSendTimestampOffset());
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 67 with UdpChannel

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

the class UdpChannelTest method shouldHandleExplicitLocalControlAddressAndPortFormatIPv4.

@Test
public void shouldHandleExplicitLocalControlAddressAndPortFormatIPv4() {
    final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?control=localhost:40124|control-mode=dynamic");
    assertThat(udpChannel.localData(), is(new InetSocketAddress("localhost", 40124)));
    assertThat(udpChannel.localControl(), is(new InetSocketAddress("localhost", 40124)));
    assertThat(udpChannel.remoteData(), is(new InetSocketAddress("0.0.0.0", 0)));
    assertThat(udpChannel.remoteControl(), is(new InetSocketAddress("0.0.0.0", 0)));
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 68 with UdpChannel

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

the class MinMulticastFlowControlTest method shouldNotBeConnectedUntilGroupMinSizeReached.

@Test
void shouldNotBeConnectedUntilGroupMinSizeReached() {
    final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?endpoint=224.20.30.39:24326|interface=localhost|fc=min,g:/3");
    flowControl.initialize(new MediaDriver.Context(), udpChannel, 0, 0);
    onStatusMessage(flowControl, 1, 0, 5000);
    assertFalse(flowControl.hasRequiredReceivers());
    onStatusMessage(flowControl, 2, 0, 5000);
    assertFalse(flowControl.hasRequiredReceivers());
    onStatusMessage(flowControl, 2, 0, 5000);
    assertFalse(flowControl.hasRequiredReceivers());
    onStatusMessage(flowControl, 3, 0, 5000);
    assertTrue(flowControl.hasRequiredReceivers());
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 69 with UdpChannel

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

the class MinMulticastFlowControlTest method shouldReportSenderLimitUntilGroupMinSizeIsReached.

@Test
void shouldReportSenderLimitUntilGroupMinSizeIsReached() {
    final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?endpoint=224.20.30.39:24326|interface=localhost|fc=min,g:/3");
    flowControl.initialize(new MediaDriver.Context(), udpChannel, 0, 0);
    final int senderLimit = 5000;
    final int termOffset = 6000;
    assertEquals(senderLimit, onStatusMessage(flowControl, 1, termOffset, senderLimit));
    assertEquals(senderLimit, onIdle(flowControl, senderLimit));
    assertEquals(senderLimit, onStatusMessage(flowControl, 2, termOffset, senderLimit));
    assertEquals(senderLimit, onIdle(flowControl, senderLimit));
    assertEquals(senderLimit, onStatusMessage(flowControl, 2, termOffset, senderLimit));
    assertEquals(senderLimit, onIdle(flowControl, senderLimit));
    assertEquals(termOffset + WINDOW_LENGTH, onStatusMessage(flowControl, 3, termOffset, senderLimit));
    assertEquals(termOffset + WINDOW_LENGTH, onIdle(flowControl, senderLimit));
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 70 with UdpChannel

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

the class StaticWindowCongestionControlTest method shouldSetWindowLengthFromContext.

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

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