@Bean
public TcpConnectionFactoryFactoryBean tcpFactory(LengthHeaderDeserializer deserializer) throws Exception {
TcpConnectionFactoryFactoryBean fact = new TcpConnectionFactoryFactoryBean();
fact.setType("server");
fact.setPort(port);
fact.setUsingNio(true);
fact.setSingleUse(false);
fact.setDeserializer(new ByteArrayLengthHeaderSerializer());
fact.setSerializer(new ByteArrayLengthHeaderSerializer());
return fact;
}
If an exception occurs in deserializer.deserialize()
, then the socket is closed by the server.
Question: how can I tell Spring to reopen the socket afterwards automatically? Or else, how could I force a reopen myself?
CodePudding user response:
That just closes the current connection from the client - the server socket remains open waiting for new connections. The client needs to reopen his connection.