INT-1797 Polishing
This commit is contained in:
@@ -3,8 +3,10 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-ip="http://www.springframework.org/schema/integration/ip"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd
|
||||
xmlns:task="http://www.springframework.org/schema/task"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
|
||||
|
||||
<int:message-history/>
|
||||
@@ -13,8 +15,11 @@
|
||||
|
||||
<int-ip:tcp-connection-factory id="server"
|
||||
type="server"
|
||||
using-nio="true"
|
||||
single-use="true"
|
||||
port="#{tcpIpUtils.findAvailableServerSocket(10000)}"
|
||||
task-executor="exec"
|
||||
so-timeout="20000"
|
||||
/>
|
||||
|
||||
<int-ip:tcp-connection-factory id="client"
|
||||
@@ -28,10 +33,13 @@
|
||||
<int-ip:tcp-inbound-gateway id="looper"
|
||||
request-channel="queue"
|
||||
connection-factory="server"
|
||||
reply-timeout="1"
|
||||
/>
|
||||
|
||||
<int:channel id="queue">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<task:executor id="exec" pool-size="10"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -69,16 +69,18 @@ public class ConnectionToConnectionTests {
|
||||
throw new Exception("Failed to listen");
|
||||
}
|
||||
}
|
||||
TcpConnection connection = client.getConnection();
|
||||
connection.send(MessageBuilder.withPayload("Test").build());
|
||||
Message<?> message = serverSideChannel.receive(10000);
|
||||
MessageHistory history = MessageHistory.read(message);
|
||||
//org.springframework.integration.test.util.TestUtils
|
||||
Properties componentHistoryRecord = TestUtils.locateComponentInHistory(history, "looper", 0);
|
||||
assertNotNull(componentHistoryRecord);
|
||||
assertTrue(componentHistoryRecord.get("type").equals("ip:tcp-inbound-gateway"));
|
||||
assertNotNull(message);
|
||||
assertEquals("Test", new String((byte[]) message.getPayload()));
|
||||
for (int i = 0; i < 100; i++) {
|
||||
TcpConnection connection = client.getConnection();
|
||||
connection.send(MessageBuilder.withPayload("Test").build());
|
||||
Message<?> message = serverSideChannel.receive(10000);
|
||||
MessageHistory history = MessageHistory.read(message);
|
||||
//org.springframework.integration.test.util.TestUtils
|
||||
Properties componentHistoryRecord = TestUtils.locateComponentInHistory(history, "looper", 0);
|
||||
assertNotNull(componentHistoryRecord);
|
||||
assertTrue(componentHistoryRecord.get("type").equals("ip:tcp-inbound-gateway"));
|
||||
assertNotNull(message);
|
||||
assertEquals("Test", new String((byte[]) message.getPayload()));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -54,7 +54,7 @@ public class TcpNioConnectionTests {
|
||||
try {
|
||||
ServerSocket server = ServerSocketFactory.getDefault().createServerSocket(port);
|
||||
latch.countDown();
|
||||
server.accept();
|
||||
Socket s = server.accept();
|
||||
// block so we fill the buffer
|
||||
server.accept();
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user