0
@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?

membersound
  • 81,582
  • 193
  • 585
  • 1,120

1 Answers1

1

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.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179