use of org.springframework.integration.ip.tcp.connection.TcpNioServerConnectionFactory in project spring-integration by spring-projects.
the class ConnectionFacforyTests method shouldReturnNioFlavor.
@Test
public void shouldReturnNioFlavor() throws Exception {
AbstractServerConnectionFactory server = Tcp.nioServer(0).get();
assertTrue(server instanceof TcpNioServerConnectionFactory);
AbstractClientConnectionFactory client = Tcp.nioClient("localhost", server.getPort()).get();
assertTrue(client instanceof TcpNioClientConnectionFactory);
}
use of org.springframework.integration.ip.tcp.connection.TcpNioServerConnectionFactory in project faf-java-server by FAForever.
the class LegacyAdapterConfig method tcpServerConnectionFactory.
/**
* Non-blocking TCP connection factory that deserializes into byte array messages.
*/
@Bean
public TcpNioServerConnectionFactory tcpServerConnectionFactory() {
ByteArrayLengthHeaderSerializer serializer = new ByteArrayLengthHeaderSerializer();
serializer.setMaxMessageSize(100 * 1024);
serializer.setApplicationEventPublisher(applicationEventPublisher);
TcpNioServerConnectionFactory connectionFactory = new TcpNioServerConnectionFactory(serverProperties.getPort());
connectionFactory.setDeserializer(serializer);
connectionFactory.setSerializer(serializer);
connectionFactory.setUsingDirectBuffers(true);
connectionFactory.getMapper().setApplySequence(true);
// See https://docs.spring.io/spring-integration/reference/html/ip.html#_thread_pool_task_executor_with_caller_runs_policy
connectionFactory.setTaskExecutor(new CompositeExecutor(createNioTaskExecutor("legacy-io-"), createNioTaskExecutor("legacy-assembler-")));
return connectionFactory;
}
Aggregations