diff --git a/xmppserver/src/main/java/org/jivesoftware/openfire/Connection.java b/xmppserver/src/main/java/org/jivesoftware/openfire/Connection.java index d53dc272ce..c564e7ba54 100644 --- a/xmppserver/src/main/java/org/jivesoftware/openfire/Connection.java +++ b/xmppserver/src/main/java/org/jivesoftware/openfire/Connection.java @@ -16,8 +16,6 @@ package org.jivesoftware.openfire; -import io.netty.channel.Channel; -import io.netty.util.concurrent.Future; import org.dom4j.Namespace; import org.jivesoftware.openfire.auth.UnauthorizedException; import org.jivesoftware.openfire.session.LocalSession; @@ -39,7 +37,7 @@ * * @author Iain Shigeoka */ -public interface Connection extends Closeable { +public interface Connection extends Closeable { /** * When a connection is used to transmit an XML data, the root element of that data can define XML namespaces other * than the ones that are default (eg: 'jabber:client', 'jabber:server', etc). For an XML parser to be able to parse @@ -351,10 +349,9 @@ default boolean isEncrypted() { * * @param clientMode boolean indicating if this entity is a client or a server in the TLS negotiation. * @param directTLS boolean indicating if the negotiation is directTLS (true) or startTLS (false). - * @return a future that resolves once TLS handshake has completed * @throws Exception if an error occurred while encrypting the connection. */ - Future startTLS(boolean clientMode, boolean directTLS) throws Exception; + void startTLS(boolean clientMode, boolean directTLS) throws Exception; /** * Adds the compression filter to the connection but only filter incoming traffic. Do not filter diff --git a/xmppserver/src/main/java/org/jivesoftware/openfire/net/SocketConnection.java b/xmppserver/src/main/java/org/jivesoftware/openfire/net/SocketConnection.java index 810a5b6f4f..a62cc3c6ed 100644 --- a/xmppserver/src/main/java/org/jivesoftware/openfire/net/SocketConnection.java +++ b/xmppserver/src/main/java/org/jivesoftware/openfire/net/SocketConnection.java @@ -18,8 +18,6 @@ import com.jcraft.jzlib.JZlib; import com.jcraft.jzlib.ZOutputStream; -import io.netty.channel.Channel; -import io.netty.util.concurrent.Future; import org.jivesoftware.openfire.*; import org.jivesoftware.openfire.auth.UnauthorizedException; import org.jivesoftware.openfire.session.IncomingServerSession; @@ -59,7 +57,7 @@ * @author Iain Shigeoka * @deprecated Old, pre NIO / MINA code. Should not be used as NIO offers better performance. Currently only in use for s2s. */ -public class SocketConnection implements Connection { +public class SocketConnection implements Connection { private static final Logger Log = LoggerFactory.getLogger(SocketConnection.class); @@ -152,7 +150,7 @@ public TLSStreamHandler getTLSStreamHandler() { return tlsStreamHandler; } - public Future startTLS(boolean clientMode, boolean directTLS) throws IOException { + public void startTLS(boolean clientMode, boolean directTLS) throws IOException { if (!isEncrypted) { isEncrypted = true; @@ -177,7 +175,6 @@ public Future startTLS(boolean clientMode, boolean directTLS) throws IOExc writer = new BufferedWriter(new OutputStreamWriter(tlsStreamHandler.getOutputStream(), StandardCharsets.UTF_8)); xmlSerializer = new XMLSocketWriter(writer, this); } - return null; } @Override diff --git a/xmppserver/src/main/java/org/jivesoftware/openfire/net/VirtualConnection.java b/xmppserver/src/main/java/org/jivesoftware/openfire/net/VirtualConnection.java index 062c31748e..f68782724f 100644 --- a/xmppserver/src/main/java/org/jivesoftware/openfire/net/VirtualConnection.java +++ b/xmppserver/src/main/java/org/jivesoftware/openfire/net/VirtualConnection.java @@ -16,8 +16,6 @@ package org.jivesoftware.openfire.net; -import io.netty.channel.Channel; -import io.netty.util.concurrent.Future; import org.jivesoftware.openfire.Connection; import org.jivesoftware.openfire.ConnectionCloseListener; import org.jivesoftware.openfire.PacketDeliverer; @@ -44,7 +42,7 @@ * * @author Gaston Dombiak */ -public abstract class VirtualConnection implements Connection { +public abstract class VirtualConnection implements Connection { private static final Logger Log = LoggerFactory.getLogger(VirtualConnection.class); @@ -111,9 +109,8 @@ public PacketDeliverer getPacketDeliverer() { return null; } - public Future startTLS(boolean clientMode, boolean directTLS) throws Exception { + public void startTLS(boolean clientMode, boolean directTLS) throws Exception { //Ignore - return null; } public void addCompression() { diff --git a/xmppserver/src/main/java/org/jivesoftware/openfire/nio/NettyConnection.java b/xmppserver/src/main/java/org/jivesoftware/openfire/nio/NettyConnection.java index 496d46eb81..2a63977408 100644 --- a/xmppserver/src/main/java/org/jivesoftware/openfire/nio/NettyConnection.java +++ b/xmppserver/src/main/java/org/jivesoftware/openfire/nio/NettyConnection.java @@ -25,7 +25,6 @@ import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslHandler; import io.netty.handler.traffic.ChannelTrafficShapingHandler; -import io.netty.util.concurrent.Future; import org.jivesoftware.openfire.Connection; import org.jivesoftware.openfire.ConnectionCloseListener; import org.jivesoftware.openfire.PacketDeliverer; @@ -63,7 +62,7 @@ * @author Matthew Vivian * @author Alex Gidman */ -public class NettyConnection implements Connection { +public class NettyConnection implements Connection { private static final Logger Log = LoggerFactory.getLogger(NettyConnection.class); public static final String SSL_HANDLER_NAME = "ssl"; @@ -388,7 +387,7 @@ private void updateWrittenBytesCounter(ChannelHandlerContext ctx) { } } - public Future startTLS(boolean clientMode, boolean directTLS) throws Exception { + public void startTLS(boolean clientMode, boolean directTLS) throws Exception { final EncryptionArtifactFactory factory = new EncryptionArtifactFactory( configuration ); @@ -406,8 +405,6 @@ public Future startTLS(boolean clientMode, boolean directTLS) throws Ex // Indicate the client that the server is ready to negotiate TLS deliverRawText( "" ); } - - return sslHandler.handshakeFuture(); } @Override diff --git a/xmppserver/src/test/java/org/jivesoftware/openfire/session/LocalOutgoingServerSessionTest.java b/xmppserver/src/test/java/org/jivesoftware/openfire/session/LocalOutgoingServerSessionTest.java index b02b21854c..2a678e8a86 100644 --- a/xmppserver/src/test/java/org/jivesoftware/openfire/session/LocalOutgoingServerSessionTest.java +++ b/xmppserver/src/test/java/org/jivesoftware/openfire/session/LocalOutgoingServerSessionTest.java @@ -16,16 +16,17 @@ package org.jivesoftware.openfire.session; import org.jivesoftware.Fixtures; -import org.jivesoftware.openfire.*; +import org.jivesoftware.openfire.Connection; +import org.jivesoftware.openfire.ConnectionManager; +import org.jivesoftware.openfire.XMPPServer; import org.jivesoftware.openfire.keystore.*; -import org.jivesoftware.openfire.net.*; +import org.jivesoftware.openfire.net.DNSUtil; import org.jivesoftware.openfire.spi.ConnectionConfiguration; import org.jivesoftware.openfire.spi.ConnectionListener; import org.jivesoftware.openfire.spi.ConnectionType; import org.jivesoftware.util.JiveGlobals; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments;