use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class DriverConductorTest method shouldOnlyRemoveSubscriptionMediaEndpointUponRemovalOfAllSubscribers.
@Test
public void shouldOnlyRemoveSubscriptionMediaEndpointUponRemovalOfAllSubscribers() throws Exception {
final UdpChannel udpChannel = UdpChannel.parse(CHANNEL_4000);
final long id1 = driverProxy.addSubscription(CHANNEL_4000, STREAM_ID_1);
final long id2 = driverProxy.addSubscription(CHANNEL_4000, STREAM_ID_2);
final long id3 = driverProxy.addSubscription(CHANNEL_4000, STREAM_ID_3);
driverConductor.doWork();
final ReceiveChannelEndpoint channelEndpoint = driverConductor.receiverChannelEndpoint(udpChannel);
assertNotNull(channelEndpoint);
assertThat(channelEndpoint.streamCount(), is(3));
driverProxy.removeSubscription(id2);
driverProxy.removeSubscription(id3);
driverConductor.doWork();
assertNotNull(driverConductor.receiverChannelEndpoint(udpChannel));
assertThat(channelEndpoint.streamCount(), is(1));
driverProxy.removeSubscription(id1);
driverConductor.doWork();
assertNull(driverConductor.receiverChannelEndpoint(udpChannel));
}
use of io.aeron.driver.media.UdpChannel in project aeron by real-logic.
the class DriverConductorTest method shouldKeepSubscriptionMediaEndpointUponRemovalOfAllButOneSubscriber.
@Test
public void shouldKeepSubscriptionMediaEndpointUponRemovalOfAllButOneSubscriber() {
final UdpChannel udpChannel = UdpChannel.parse(CHANNEL_4000);
final long id1 = driverProxy.addSubscription(CHANNEL_4000, STREAM_ID_1);
final long id2 = driverProxy.addSubscription(CHANNEL_4000, STREAM_ID_2);
driverProxy.addSubscription(CHANNEL_4000, STREAM_ID_3);
driverConductor.doWork();
final ReceiveChannelEndpoint channelEndpoint = driverConductor.receiverChannelEndpoint(udpChannel);
assertNotNull(channelEndpoint);
assertThat(channelEndpoint.streamCount(), is(3));
driverProxy.removeSubscription(id1);
driverProxy.removeSubscription(id2);
driverConductor.doWork();
assertNotNull(driverConductor.receiverChannelEndpoint(udpChannel));
assertThat(channelEndpoint.streamCount(), is(1));
}
use of io.aeron.driver.media.UdpChannel in project aeron by real-logic.
the class UdpChannelTest method shouldGetProtocolFamilyForIpV6.
@Test
public void shouldGetProtocolFamilyForIpV6() {
final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?endpoint=[::1]:12345|interface=[::1]");
assertThat(udpChannel.protocolFamily(), is(StandardProtocolFamily.INET6));
}
use of io.aeron.driver.media.UdpChannel in project aeron by real-logic.
the class UdpChannelTest method shouldHandleLocalhostLookup.
@Test
public void shouldHandleLocalhostLookup() {
final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?endpoint=localhost:40124");
assertThat(udpChannel.remoteData(), is(new InetSocketAddress("127.0.0.1", 40124)));
assertThat(udpChannel.remoteControl(), is(new InetSocketAddress("127.0.0.1", 40124)));
}
use of io.aeron.driver.media.UdpChannel in project aeron by real-logic.
the class UdpChannelTest method shouldHandleIPv4AnyAddressAsInterfaceAddressForUnicast.
@Theory
public void shouldHandleIPv4AnyAddressAsInterfaceAddressForUnicast(@Values({ "endpoint" }) final String endpointKey, @Values({ "interface" }) final String interfaceKey) {
final UdpChannel udpChannel = UdpChannel.parse(uri(endpointKey, "localhost:40124", interfaceKey, "0.0.0.0"));
assertThat(udpChannel.localData(), is(new InetSocketAddress("0.0.0.0", 0)));
assertThat(udpChannel.localControl(), is(new InetSocketAddress("0.0.0.0", 0)));
assertThat(udpChannel.remoteData(), is(new InetSocketAddress("localhost", 40124)));
assertThat(udpChannel.remoteControl(), is(new InetSocketAddress("localhost", 40124)));
}
Aggregations