use of org.opensearch.transport.TcpTransport in project OpenSearch by opensearch-project.
the class SimpleNetty4TransportTests method testDefaultKeepAliveSettings.
public void testDefaultKeepAliveSettings() throws IOException {
assumeTrue("setting default keepalive options not supported on this platform", (IOUtils.LINUX || IOUtils.MAC_OS_X) && JavaVersion.current().compareTo(JavaVersion.parse("11")) >= 0);
try (MockTransportService serviceC = buildService("TS_C", Version.CURRENT, Settings.EMPTY);
MockTransportService serviceD = buildService("TS_D", Version.CURRENT, Settings.EMPTY)) {
serviceC.start();
serviceC.acceptIncomingRequests();
serviceD.start();
serviceD.acceptIncomingRequests();
try (Transport.Connection connection = serviceC.openConnection(serviceD.getLocalDiscoNode(), TestProfiles.LIGHT_PROFILE)) {
assertThat(connection, instanceOf(StubbableTransport.WrappedConnection.class));
Transport.Connection conn = ((StubbableTransport.WrappedConnection) connection).getConnection();
assertThat(conn, instanceOf(TcpTransport.NodeChannels.class));
TcpTransport.NodeChannels nodeChannels = (TcpTransport.NodeChannels) conn;
for (TcpChannel channel : nodeChannels.getChannels()) {
assertFalse(channel.isServerChannel());
checkDefaultKeepAliveOptions(channel);
}
assertThat(serviceD.getOriginalTransport(), instanceOf(TcpTransport.class));
for (TcpChannel channel : getAcceptedChannels((TcpTransport) serviceD.getOriginalTransport())) {
assertTrue(channel.isServerChannel());
checkDefaultKeepAliveOptions(channel);
}
}
}
}
Aggregations