Fix TCP tests to use 0 port
https://build.spring.io/browse/INT-MJATS41-495 https://build.spring.io/browse/INT-AT42SIO-16 Can be backported to `4.2.x` on demand
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
id="scf"
|
||||
type="server"
|
||||
so-timeout="60000"
|
||||
port="#{tcpIpUtils.findAvailableServerSocket()}"/>
|
||||
port="#{tcpIpUtils.findAvailableServerSocket(0)}"/>
|
||||
|
||||
<int-ip:tcp-inbound-channel-adapter
|
||||
connection-factory="scf"
|
||||
|
||||
@@ -249,7 +249,7 @@ public class FailoverClientConnectionFactoryTests {
|
||||
@Test
|
||||
public void testRealNet() throws Exception {
|
||||
|
||||
final List<Integer> openPorts = SocketUtils.findAvailableServerSockets(SocketUtils.getRandomSeedPort(), 2);
|
||||
final List<Integer> openPorts = SocketUtils.findAvailableServerSockets(0, 2);
|
||||
|
||||
int port1 = openPorts.get(0);
|
||||
int port2 = openPorts.get(1);
|
||||
@@ -263,7 +263,7 @@ public class FailoverClientConnectionFactoryTests {
|
||||
@Test
|
||||
public void testRealNio() throws Exception {
|
||||
|
||||
final List<Integer> openPorts = SocketUtils.findAvailableServerSockets(SocketUtils.getRandomSeedPort(), 2);
|
||||
final List<Integer> openPorts = SocketUtils.findAvailableServerSockets(0, 2);
|
||||
|
||||
int port1 = openPorts.get(0);
|
||||
int port2 = openPorts.get(1);
|
||||
@@ -278,7 +278,7 @@ public class FailoverClientConnectionFactoryTests {
|
||||
@Test
|
||||
public void testRealNetSingleUse() throws Exception {
|
||||
|
||||
final List<Integer> openPorts = SocketUtils.findAvailableServerSockets(SocketUtils.getRandomSeedPort(), 2);
|
||||
final List<Integer> openPorts = SocketUtils.findAvailableServerSockets(0, 2);
|
||||
|
||||
int port1 = openPorts.get(0);
|
||||
int port2 = openPorts.get(1);
|
||||
@@ -295,7 +295,7 @@ public class FailoverClientConnectionFactoryTests {
|
||||
@Test
|
||||
public void testRealNioSingleUse() throws Exception {
|
||||
|
||||
final List<Integer> openPorts = SocketUtils.findAvailableServerSockets(SocketUtils.getRandomSeedPort(), 2);
|
||||
final List<Integer> openPorts = SocketUtils.findAvailableServerSockets(0, 2);
|
||||
|
||||
int port1 = openPorts.get(0);
|
||||
int port2 = openPorts.get(1);
|
||||
@@ -591,7 +591,6 @@ public class FailoverClientConnectionFactoryTests {
|
||||
else {
|
||||
return TestUtils.getPropertyValue(client.getConnection(), "socketChannel", SocketChannel.class).socket();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public final class SocketUtils {
|
||||
ServerSocket sock = ServerSocketFactory.getDefault()
|
||||
.createServerSocket(i, 1, InetAddress.getByName("localhost"));
|
||||
sock.close();
|
||||
openPorts.add(i);
|
||||
openPorts.add(i == 0 ? sock.getLocalPort() : i);
|
||||
|
||||
if (openPorts.size() == numberOfRequestedPorts) {
|
||||
return openPorts;
|
||||
|
||||
Reference in New Issue
Block a user