title: spring integration time out clients
body: <p>My scenario with spring integration is:</p>
  
  <ol>
  <li>tens producer that send the data using a custom protocol(size and content)</li>
  <li>I have to decode this custom protocol and then handler the result.</li>
  </ol>
  
  <p>So I tried lots configuration, the best for this moment is the follow:</p>
  
  <pre><code>&lt;bean id="serializer" class="com.MySerializerDeserializer" /&gt;
  &lt;task:executor id="myTaskExecutor" pool-size="5-300" queue-capacity="500000"/&gt;
  &lt;int-ip:tcp-connection-factory id="serverTcpConFact"
      type="server"
      port="5566"
      using-nio="true"
      single-use="false"
      so-timeout="5000"
      task-executor="myTaskExecutor"
      deserializer="serializer" 
      serializer="serializer"/&gt;
  
  &lt;int-ip:tcp-inbound-channel-adapter id="tcpInboundAdapter"
      channel="tcpInbound"
      connection-factory="serverTcpConFact" /&gt;
  
  &lt;int:channel id="tcpInbound" /&gt;
  
  &lt;int:service-activator input-channel="tcpInbound"
      ref="importService"
      method="handler" /&gt;
  
  &lt;bean id="importService" class="com.MyImportService" /&gt;
  </code></pre>
  
  <p>The serialization class is:</p>
  
  <pre><code>public class MySerializerDeserializer implements Serializer&lt; MyMessage &gt;, Deserializer&lt; MyMessage &gt; {
  
      @Override
      public MyMessage deserialize(InputStream inputStream) throws IOException {
          DataInputStream dis = new DataInputStream(inputStream);
          int size = dis.readInt();
          byte[] b = new byte[size];
          dis.read(b);
          MyMessage s = new MyMessage ();
          String value = new String(b);
          s.setTest(value);
          return s;
  </code></pre>
  
  <p>I use this code to thest the server:</p>
  
  <pre><code>class SimpleThread extends Thread {
      public void run() {
          try {
              String id = java.util.UUID.randomUUID().toString();
              try (Socket echoSocket = new Socket("localhost", 5566)) {
                  DataOutputStream dos = new DataOutputStream(echoSocket.getOutputStream());
                  for (int i = 0; i &lt; 500; i++) {
                      String s = id + " " + i;
                 dos.writeInt(s.length());
                      dos.write(s.getBytes());
                      dos.flush();
                      System.out.println(id + " - " + i + " - " + s.length());
                  }
              }
  </code></pre>
  
  <p>When I execute this with a single thread works fine when I try to execute more than one threads Like:</p>
  
  <pre><code>  for (int i = 0; i &lt; 5; i++) {
   new SimpleThread().start();
   }
  </code></pre>
  
  <p>The spring integration server gets stuck and I have the follow WARN:</p>
  
  <pre><code>WARN _[m [THREAD ID=myTaskExecutor-1] 2014-06-25 12:42:18 WARN  org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory:566 - Timing out TcpNioConnection 127.0.0.1:56273:5566:4e3caf61-1101-4881-a1cf-1c31610b33f3
  </code></pre>
  
  <p>And it doesn’t work, The server can't recive the messages.</p>
  
  <p>With this error:
  <img src="https://i.stack.imgur.com/8qb6h.png" alt="enter image description here"></p>
  
  <p>Where am I wrong? 
  Thank you. </p>
  
  <p>EDIT</p>
  
  <p>I modified the thread poll in this way:</p>
  
  <pre><code>&lt;bean id="myTaskExecutor" class="org.springframework.integration.util.CompositeExecutor"&gt;
      &lt;constructor-arg&gt;
          &lt;bean class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"&gt;
              &lt;property name="threadNamePrefix" value="io-" /&gt;
              &lt;property name="corePoolSize" value="4" /&gt;
              &lt;property name="maxPoolSize" value="8" /&gt;
              &lt;property name="queueCapacity" value="50000" /&gt;
              &lt;property name="rejectedExecutionHandler"&gt;
                  &lt;bean class="org.springframework.integration.util.CallerBlocksPolicy"&gt;
                      &lt;constructor-arg value="10000" /&gt;
                  &lt;/bean&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
      &lt;/constructor-arg&gt;
      &lt;constructor-arg&gt;
          &lt;bean class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"&gt;
              &lt;property name="threadNamePrefix" value="assembler-" /&gt;
              &lt;property name="corePoolSize" value="4" /&gt;
              &lt;property name="maxPoolSize" value="10" /&gt;
              &lt;property name="queueCapacity" value="50000" /&gt;
              &lt;property name="rejectedExecutionHandler"&gt;
                  &lt;bean class="org.springframework.integration.util.CallerBlocksPolicy"&gt;
                      &lt;constructor-arg value="10000" /&gt;
                  &lt;/bean&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
      &lt;/constructor-arg&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>And the server is more responvive, but the I still have the problem</p>
  
  <p>**EDIT*****</p>
  
  <p>The import service is:</p>
  
  <pre><code>public class ImportService {
  
      public void handler(MyMessage inp) {
          System.out.println(Thread.currentThread().getName() + "******" + inp.getTest());
  
      }
  </code></pre>