title: How to retry socket server creation with spring-integration?
body: <p>The following is my socket server configuration. I want to define a fallback/failover port.</p>
  
  <p>How can I retry the socket bean creation (eg with a fallback port) if the current port is already in use?</p>
  
  <p>If the failover port is also already in use: how can I retry the socket creation as long until it succeeds (eg für 5 mins)?</p>
  
  <pre><code>    @Bean
      public TcpConnectionFactoryFactoryBean factory() {
          TcpConnectionFactoryFactoryBean f = new TcpConnectionFactoryFactoryBean();
          f.setType("server");
          f.setPort(port); //I want to retry and switch that port
          f.setUsingNio(true);
          f.setSingleUse(false);
          f.setDeserializer(deserializer);
          f.setSerializer(serializer);
          return f;
      }
  
      @Bean
      public TcpInboundGateway server(
              TcpConnectionFactoryFactoryBean factory,
              MessageChannel serverChannel) throws Exception {
          TcpInboundGateway g = new TcpInboundGateway();
          g.setConnectionFactory(factory.getObject());
          g.setRequestChannel(serverChannel);
          return g;
      }
  </code></pre>