Search in sources :

Example 6 with Protocol

use of org.jivesoftware.util.Protocol in project Smack by igniterealtime.

the class InBandBytestreamSessionTest method setup.

/**
     * Initialize fields used in the tests.
     * @throws XMPPException 
     * @throws SmackException 
     * @throws InterruptedException 
     */
@Before
public void setup() throws XMPPException, SmackException, InterruptedException {
    // build protocol verifier
    protocol = new Protocol();
    // create mocked XMPP connection
    connection = ConnectionUtils.createMockedConnection(protocol, initiatorJID, xmppServer);
    // initialize InBandBytestreamManager to get the InitiationListener
    byteStreamManager = InBandBytestreamManager.getByteStreamManager(connection);
    // create a In-Band Bytestream open packet
    initBytestream = new Open(sessionID, blockSize);
    initBytestream.setFrom(initiatorJID);
    initBytestream.setTo(targetJID);
    incrementingSequence = new Verification<Data, IQ>() {

        long lastSeq = 0;

        @Override
        public void verify(Data request, IQ response) {
            assertEquals(lastSeq++, request.getDataPacketExtension().getSeq());
        }
    };
}
Also used : IQ(org.jivesoftware.smack.packet.IQ) Data(org.jivesoftware.smackx.bytestreams.ibb.packet.Data) Protocol(org.jivesoftware.util.Protocol) Open(org.jivesoftware.smackx.bytestreams.ibb.packet.Open) Before(org.junit.Before)

Aggregations

Protocol (org.jivesoftware.util.Protocol)6 Before (org.junit.Before)6 IQ (org.jivesoftware.smack.packet.IQ)2 Open (org.jivesoftware.smackx.bytestreams.ibb.packet.Open)2 Message (org.jivesoftware.smack.packet.Message)1 Data (org.jivesoftware.smackx.bytestreams.ibb.packet.Data)1 DataPacketExtension (org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension)1