mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-18 08:51:08 +01:00
Introduce Smack's Modular Connection Architecture
This is a complete redesign of what was previously XmppNioTcpConnection. The new architecture allows to extend an XMPP client to server (c2s) connection with new transport bindings and other extensions.
This commit is contained in:
parent
cec312fe64
commit
cc636fff21
142 changed files with 6819 additions and 4068 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2015-2019 Florian Schmaus
|
||||
* Copyright 2015-2020 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -51,7 +51,7 @@ public class ChatTest extends AbstractSmackIntegrationTest {
|
|||
private boolean invoked;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public ChatTest(SmackIntegrationTestEnvironment<?> environment) {
|
||||
public ChatTest(SmackIntegrationTestEnvironment environment) {
|
||||
super(environment);
|
||||
chatManagerOne = org.jivesoftware.smack.chat.ChatManager.getInstanceFor(conOne);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2015-2019 Florian Schmaus
|
||||
* Copyright 2015-2020 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -33,7 +33,7 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
|||
|
||||
public class LoginIntegrationTest extends AbstractSmackLowLevelIntegrationTest {
|
||||
|
||||
public LoginIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
|
||||
public LoginIntegrationTest(SmackIntegrationTestEnvironment environment) {
|
||||
super(environment);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2015-2019 Florian Schmaus
|
||||
* Copyright 2015-2020 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -35,7 +35,7 @@ import org.igniterealtime.smack.inttest.TestNotPossibleException;
|
|||
|
||||
public class StreamManagementTest extends AbstractSmackSpecificLowLevelIntegrationTest<XMPPTCPConnection> {
|
||||
|
||||
public StreamManagementTest(SmackIntegrationTestEnvironment<?> environment) throws Exception {
|
||||
public StreamManagementTest(SmackIntegrationTestEnvironment environment) throws Exception {
|
||||
super(environment, XMPPTCPConnection.class);
|
||||
XMPPTCPConnection connection = getSpecificUnconnectedConnection();
|
||||
connection.connect().login();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2015-2019 Florian Schmaus
|
||||
* Copyright 2015-2020 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -26,7 +26,7 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
|||
|
||||
public class WaitForClosingStreamElementTest extends AbstractSmackLowLevelIntegrationTest {
|
||||
|
||||
public WaitForClosingStreamElementTest(SmackIntegrationTestEnvironment<?> environment) {
|
||||
public WaitForClosingStreamElementTest(SmackIntegrationTestEnvironment environment) {
|
||||
super(environment);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2018-2019 Florian Schmaus
|
||||
* Copyright 2018-2020 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smack;
|
|||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.jivesoftware.smack.tcp.XmppNioTcpConnection;
|
||||
import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection;
|
||||
|
||||
import org.igniterealtime.smack.XmppConnectionStressTest;
|
||||
import org.igniterealtime.smack.XmppConnectionStressTest.StressTestFailedException.ErrorsWhileSendingOrReceivingException;
|
||||
|
|
@ -30,7 +30,7 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
|||
|
||||
public class XmppConnectionIntegrationTest extends AbstractSmackLowLevelIntegrationTest {
|
||||
|
||||
public XmppConnectionIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
|
||||
public XmppConnectionIntegrationTest(SmackIntegrationTestEnvironment environment) {
|
||||
super(environment);
|
||||
}
|
||||
|
||||
|
|
@ -52,12 +52,12 @@ public class XmppConnectionIntegrationTest extends AbstractSmackLowLevelIntegrat
|
|||
|
||||
final Level connectionStatsLogLevel = Level.FINE;
|
||||
if (LOGGER.isLoggable(connectionStatsLogLevel)) {
|
||||
if (connections.get(0) instanceof XmppNioTcpConnection) {
|
||||
if (connections.get(0) instanceof ModularXmppClientToServerConnection) {
|
||||
for (XMPPConnection connection : connections) {
|
||||
XmppNioTcpConnection xmppNioTcpConnection = (XmppNioTcpConnection) connection;
|
||||
XmppNioTcpConnection.Stats stats = xmppNioTcpConnection.getStats();
|
||||
ModularXmppClientToServerConnection xmppC2sConnection = (ModularXmppClientToServerConnection) connection;
|
||||
ModularXmppClientToServerConnection.Stats stats = xmppC2sConnection.getStats();
|
||||
LOGGER.log(connectionStatsLogLevel,
|
||||
"Connections stats for " + xmppNioTcpConnection + ":\n{}",
|
||||
"Connections stats for " + xmppC2sConnection + ":\n{}",
|
||||
stats);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2018 Florian Schmaus
|
||||
* Copyright 2018-2020 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -25,7 +25,7 @@ public abstract class AbstractChatIntegrationTest extends AbstractSmackIntegrati
|
|||
protected final ChatManager chatManagerTwo;
|
||||
protected final ChatManager chatManagerThree;
|
||||
|
||||
protected AbstractChatIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
|
||||
protected AbstractChatIntegrationTest(SmackIntegrationTestEnvironment environment) {
|
||||
super(environment);
|
||||
chatManagerOne = ChatManager.getInstanceFor(conOne);
|
||||
chatManagerTwo = ChatManager.getInstanceFor(conTwo);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import org.jxmpp.jid.EntityBareJid;
|
|||
|
||||
public class IncomingMessageListenerIntegrationTest extends AbstractChatIntegrationTest {
|
||||
|
||||
public IncomingMessageListenerIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
|
||||
public IncomingMessageListenerIntegrationTest(SmackIntegrationTestEnvironment environment) {
|
||||
super(environment);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import org.jxmpp.jid.EntityBareJid;
|
|||
|
||||
public class OutgoingMessageListenerIntegrationTest extends AbstractChatIntegrationTest {
|
||||
|
||||
public OutgoingMessageListenerIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
|
||||
public OutgoingMessageListenerIntegrationTest(SmackIntegrationTestEnvironment environment) {
|
||||
super(environment);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2016-2019 Florian Schmaus
|
||||
* Copyright 2016-2020 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -30,7 +30,7 @@ import org.jxmpp.jid.FullJid;
|
|||
|
||||
public class LowLevelRosterIntegrationTest extends AbstractSmackLowLevelIntegrationTest {
|
||||
|
||||
public LowLevelRosterIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
|
||||
public LowLevelRosterIntegrationTest(SmackIntegrationTestEnvironment environment) {
|
||||
super(environment);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2015-2019 Florian Schmaus
|
||||
* Copyright 2015-2020 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -38,7 +38,7 @@ public class RosterIntegrationTest extends AbstractSmackIntegrationTest {
|
|||
private final Roster rosterOne;
|
||||
private final Roster rosterTwo;
|
||||
|
||||
public RosterIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
|
||||
public RosterIntegrationTest(SmackIntegrationTestEnvironment environment) {
|
||||
super(environment);
|
||||
rosterOne = Roster.getInstanceFor(conOne);
|
||||
rosterTwo = Roster.getInstanceFor(conTwo);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2018-2019 Florian Schmaus
|
||||
* Copyright 2018-2020 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -22,21 +22,22 @@ import java.security.NoSuchAlgorithmException;
|
|||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackSpecificLowLevelIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
|
||||
public class XmppNioTcpConnectionLowLevelIntegrationTest extends AbstractSmackSpecificLowLevelIntegrationTest<XmppNioTcpConnection> {
|
||||
public class XmppNioTcpConnectionLowLevelIntegrationTest extends AbstractSmackSpecificLowLevelIntegrationTest<ModularXmppClientToServerConnection> {
|
||||
|
||||
public XmppNioTcpConnectionLowLevelIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
|
||||
super(environment, XmppNioTcpConnection.class);
|
||||
public XmppNioTcpConnectionLowLevelIntegrationTest(SmackIntegrationTestEnvironment environment) {
|
||||
super(environment, ModularXmppClientToServerConnection.class);
|
||||
}
|
||||
|
||||
@SmackIntegrationTest
|
||||
public void testDisconnectAfterConnect() throws KeyManagementException, NoSuchAlgorithmException, SmackException,
|
||||
IOException, XMPPException, InterruptedException {
|
||||
XmppNioTcpConnection connection = getSpecificUnconnectedConnection();
|
||||
ModularXmppClientToServerConnection connection = getSpecificUnconnectedConnection();
|
||||
|
||||
connection.connect();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue