title: Spring Integration receive and send messages over a tcp connection
body: <p>I'm trying to implement the following scenario using Spring Integration:</p>
  
  <ul>
  <li>I need to connect to a server via TCP IP and process messages received.</li>
  <li>I need to send messages to the same server from which receive and process responses.</li>
  </ul>
  
  <p>This is my config:</p>
  
  <pre><code> &lt;channel id="input"&gt;
  
          &lt;interceptors&gt;
              &lt;wire-tap channel="logger"/&gt;
          &lt;/interceptors&gt;
      &lt;/channel&gt;
  
  
      &lt;logging-channel-adapter id="logger" level="DEBUG" log-full-message="true"/&gt;
  
      &lt;ip:tcp-connection-factory id="factory" type="client" host="localhost" port="9004" single-use="false"
                                 using-nio="true" deserializer="javaDeserializer"/&gt;
  
      &lt;ip:tcp-inbound-channel-adapter id="inbound" channel="input" connection-factory="factory" client-mode="true"
                                      retry-interval="5000"/&gt;
  </code></pre>
  
  <p>I can receive messages sent from the server, but I have no idea how to convert a string. javaDeserializer is not invoked when messages arrive. </p>
  
  <pre><code>2014-01-19 05:47:20 DEBUG TcpNioConnection:380 - localhost:9004:74154fb2-f77c-4036-9142-e756e53a6ac6 Reading...
  2014-01-19 05:47:20 DEBUG TcpNioConnection:324 - Read 26 into raw buffer
  2014-01-19 05:47:25 DEBUG TcpNioConnection:380 - localhost:9004:74154fb2-f77c-4036-9142-e756e53a6ac6 Reading...
  2014-01-19 05:47:25 DEBUG TcpNioConnection:324 - Read 26 into raw buffer
  2014-01-19 05:47:30 DEBUG TcpNioConnection:380 - localhost:9004:74154fb2-f77c-4036-9142-e756e53a6ac6 Reading...
  2014-01-19 05:47:30 DEBUG TcpNioConnection:324 - Read 26 into raw buffer
  2014-01-19 05:47:35 DEBUG TcpNioConnection:380 - localhost:9004:74154fb2-f77c-4036-9142-e756e53a6ac6 Reading...
  2014-01-19 05:47:35 DEBUG TcpNioConnection:324 - Read 26 into raw buffer
  </code></pre>
  
  <p>With <a href="https://github.com/spring-projects/spring-integration-samples/tree/master/basic/tcp-client-server" rel="nofollow">this</a> example, you can send messages and process the reply from the server, but the connection will close and not kept listening to the messages from the server. Any idea how to solve this?</p>
  
  <p>Thanks in advance.</p>
  
  <p>Eduardo</p>