1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-23 04:22:05 +01:00

Fix Protocol code examples in Javadoc

This commit is contained in:
Florian Schmaus 2018-04-18 13:20:23 +02:00
parent 73168bff69
commit 2050845289

View file

@ -42,20 +42,22 @@ import org.jivesoftware.smack.util.XmlUtil;
* <pre> * <pre>
* <code> * <code>
* public void methodToTest() { * public void methodToTest() {
* Stanza(/Packet) stanza = new Packet(); // create an XMPP packet * Stanza stanza = new Packet(); // create an XMPP packet
* StanzaCollector collector = connection.createStanzaCollector(new StanzaIdFilter()); * StanzaCollector collector = connection.createStanzaCollector(new StanzaIdFilter());
* connection.sendStanza(packet); * connection.sendStanza(packet);
* Stanza(/Packet) reply = collector.nextResult(); * Stanza reply = collector.nextResult();
* } * }
* *
* public void testMethod() { * public void testMethod() {
* EntityFullJid userJid = JidCreate.entityFullFrom("user@xmpp-server.org");
* DomainBareJid serverJid = JidCreate.domainBareFrom("user-server.org");
* // create protocol * // create protocol
* Protocol protocol = new Protocol(); * Protocol protocol = new Protocol();
* // create mocked connection * // create mocked connection
* XMPPConnection connection = ConnectionUtils.createMockedConnection(protocol, "user@xmpp-server", "xmpp-server"); * XMPPConnection connection = ConnectionUtils.createMockedConnection(protocol, userJid, serverJid);
* *
* // add reply stanza to protocol * // add reply stanza to protocol
* Stanza(/Packet) reply = new Packet(); * Stanza reply = new Packet();
* protocol.add(reply); * protocol.add(reply);
* *
* // call method to test * // call method to test
@ -74,6 +76,7 @@ import org.jivesoftware.smack.util.XmlUtil;
* If the {@link #printProtocol} flag is set to true {@link #verifyAll()} will * If the {@link #printProtocol} flag is set to true {@link #verifyAll()} will
* also print out the XML messages in the order they are sent to the console. * also print out the XML messages in the order they are sent to the console.
* This may be useful to inspect the whole protocol "by hand". * This may be useful to inspect the whole protocol "by hand".
* </p>
* *
* @author Henning Staib * @author Henning Staib
*/ */