INT-4364 Deprecate SocketUtils and remove all use

JIRA: https://jira.spring.io/browse/INT-4364

Always let the OS choose the ports for tests.

Just one test remains (RMI) because there appears to be no way to obtain
the port after creating a registry with a 0 port.

This test has been switched to use the Spring utility.

Polishing - PR Comments
This commit is contained in:
Gary Russell
2017-11-13 12:49:49 -05:00
committed by Artem Bilan
parent 8c89d0ef98
commit 4207f36a17
25 changed files with 256 additions and 267 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,6 +52,16 @@ public class TcpSyslogReceivingChannelAdapter extends SyslogReceivingChannelAdap
this.applicationEventPublisher = applicationEventPublisher;
}
@Override
protected int getPort() {
if (this.connectionFactory == null) {
return super.getPort();
}
else {
return this.connectionFactory.getPort();
}
}
@Override
public String getComponentType() {
return "syslog:inbound-channel-adapter(tcp)";
@@ -61,7 +71,7 @@ public class TcpSyslogReceivingChannelAdapter extends SyslogReceivingChannelAdap
protected void onInit() {
super.onInit();
if (this.connectionFactory == null) {
this.connectionFactory = new TcpNioServerConnectionFactory(this.getPort());
this.connectionFactory = new TcpNioServerConnectionFactory(getPort());
this.connectionFactory.setDeserializer(new ByteArrayLfSerializer());
this.connectionFactory.setBeanFactory(getBeanFactory());
if (this.applicationEventPublisher != null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,6 +38,16 @@ public class UdpSyslogReceivingChannelAdapter extends SyslogReceivingChannelAdap
this.udpAdapterSet = true;
}
@Override
protected int getPort() {
if (this.udpAdapter == null) {
return super.getPort();
}
else {
return this.udpAdapter.getPort();
}
}
@Override
public String getComponentType() {
return "syslog:inbound-channel-adapter(udp)";
@@ -47,7 +57,7 @@ public class UdpSyslogReceivingChannelAdapter extends SyslogReceivingChannelAdap
protected void onInit() {
super.onInit();
if (this.udpAdapter == null) {
this.udpAdapter = new UnicastReceivingChannelAdapter(this.getPort());
this.udpAdapter = new UnicastReceivingChannelAdapter(getPort());
this.udpAdapter.setBeanFactory(getBeanFactory());
}
else {