Search in sources :

Example 91 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 92 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 93 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 94 with UdpChannel

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

the class SpySubscriptionLink method matches.

boolean matches(final NetworkPublication publication) {
    final UdpChannel publicationChannel = publication.channelEndpoint().udpChannel();
    final boolean isSameChannelTag = udpChannel.hasTag() && udpChannel.tag() == publicationChannel.tag();
    return streamId == publication.streamId() && (isSameChannelTag || (isWildcardOrSessionIdMatch(publication.sessionId()) && udpChannel.canonicalForm().equals(publicationChannel.canonicalForm())));
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel)

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