This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new d8e613c964b4 fix(components): smpp socket closure design note
d8e613c964b4 is described below
commit d8e613c964b4946137c04633c129089926960ea3
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Tue Dec 2 11:07:49 2025 +0100
fix(components): smpp socket closure design note
---
.../org/apache/camel/component/smpp/SmppConnectionFactory.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git
a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConnectionFactory.java
b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConnectionFactory.java
index 1ac673acf1a6..7a1a962343b5 100644
---
a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConnectionFactory.java
+++
b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConnectionFactory.java
@@ -89,15 +89,15 @@ public final class SmppConnectionFactory implements
ConnectionFactory {
? SSLSocketFactory
.getDefault()
: SocketFactory.getDefault();
+ // NOTE: the socket must be closed by the factory method client.
+ socket = socketFactory.createSocket(); // NOSONAR
if (config.getHttpProxyHost() != null) {
// setup the proxy tunnel
- socket = socketFactory.createSocket();
// jsmpp uses enquire link timer as socket read timeout, so
also use it to establish the initial connection
socket.connect(new
InetSocketAddress(config.getHttpProxyHost(), config.getHttpProxyPort()),
config.getEnquireLinkTimer());
connectProxy(host, port, socket);
} else {
- socket = socketFactory.createSocket();
// jsmpp uses enquire link timer as socket read timeout, so
also use it to establish the initial connection
socket.connect(new InetSocketAddress(host, port),
config.getEnquireLinkTimer());
}
@@ -105,7 +105,8 @@ public final class SmppConnectionFactory implements
ConnectionFactory {
if (config.isUsingSSL() && config.getHttpProxyHost() != null) {
// Init the SSL socket which is based on the proxy socket
SSLSocketFactory sslSocketFactory = (SSLSocketFactory)
SSLSocketFactory.getDefault();
- SSLSocket sslSocket = (SSLSocket)
sslSocketFactory.createSocket(socket, host, port, true);
+ // NOTE: the socket must be closed by the factory method
client.
+ SSLSocket sslSocket = (SSLSocket)
sslSocketFactory.createSocket(socket, host, port, true); // NOSONAR
sslSocket.startHandshake();
socket = sslSocket;
}