Package org.jivesoftware.smackx.bytestreams.ibb.packet

Examples of org.jivesoftware.smackx.bytestreams.ibb.packet.Data


*/
public class DataTest {

    @Test(expected = IllegalArgumentException.class)
    public void shouldNotInstantiateWithInvalidArgument() {
        new Data(null);
    }
View Full Code Here


    }

    @Test
    public void shouldBeOfIQTypeSET() {
        DataPacketExtension dpe = mock(DataPacketExtension.class);
        Data data = new Data(dpe);
        assertEquals(IQ.Type.SET, data.getType());
    }
View Full Code Here

            .a("seq", "0")
            .a("sid", "i781hf64")
            .t(encodedData)
            .asString(outputProperties);
        when(dpe.toXML()).thenReturn(dataTag);
        Data data = new Data(dpe);
        data.setFrom("romeo@montague.lit/orchard");
        data.setTo("juliet@capulet.lit/balcony");
        data.setPacketID("kr91n475");
       
        assertXMLEqual(control, data.toXML());
    }
View Full Code Here

        // insert data to read
        InputStream inputStream = session.getInputStream();
        PacketListener listener = Whitebox.getInternalState(inputStream, PacketListener.class);
        String base64Data = StringUtils.encodeBase64("Data");
        DataPacketExtension dpe = new DataPacketExtension(sessionID, 0, base64Data);
        Data data = new Data(dpe);
        listener.processPacket(data);

        // verify no packet send
        protocol.verifyAll();
View Full Code Here

        InputStream inputStream = session.getInputStream();
        PacketListener listener = Whitebox.getInternalState(inputStream, PacketListener.class);

        String base64Data = StringUtils.encodeBase64("Data");
        DataPacketExtension dpe = new DataPacketExtension(sessionID, 0, base64Data);
        Data data = new Data(dpe);

        listener.processPacket(data);

        protocol.verifyAll();
View Full Code Here

        PacketListener listener = Whitebox.getInternalState(inputStream, PacketListener.class);

        // build data packets
        String base64Data = StringUtils.encodeBase64("Data");
        DataPacketExtension dpe = new DataPacketExtension(sessionID, 0, base64Data);
        Data data1 = new Data(dpe);
        Data data2 = new Data(dpe);

        // notify listener
        listener.processPacket(data1);
        listener.processPacket(data2);
View Full Code Here

        InputStream inputStream = session.getInputStream();
        PacketListener listener = Whitebox.getInternalState(inputStream, PacketListener.class);

        // build data packets
        DataPacketExtension dpe = new DataPacketExtension(sessionID, 0, "AA=BB");
        Data data = new Data(dpe);

        // notify listener
        listener.processPacket(data);

        protocol.verifyAll();
View Full Code Here

        PacketListener listener = Whitebox.getInternalState(inputStream, PacketListener.class);

        // build invalid packet with out of order sequence
        String base64Data = StringUtils.encodeBase64("Data");
        DataPacketExtension dpe = new DataPacketExtension(sessionID, 123, base64Data);
        Data data = new Data(dpe);

        // add data packets
        listener.processPacket(data);

        // read until exception is thrown
View Full Code Here

        for (int i = 0; i < controlData.length / blockSize; i++) {
            protocol.addResponse(resultIQ);
            String base64Data = StringUtils.encodeBase64(controlData, i * blockSize, blockSize,
                            false);
            DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data);
            Data data = new Data(dpe);
            listener.processPacket(data);
        }

        byte[] bytes = new byte[3 * blockSize];
        int read = 0;
View Full Code Here

        for (int i = 0; i < controlData.length / blockSize; i++) {
            protocol.addResponse(resultIQ);
            String base64Data = StringUtils.encodeBase64(controlData, i * blockSize, blockSize,
                            false);
            DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data);
            Data data = new Data(dpe);
            listener.processPacket(data);
        }

        // read data
        byte[] bytes = new byte[3 * blockSize];
 
View Full Code Here

TOP

Related Classes of org.jivesoftware.smackx.bytestreams.ibb.packet.Data

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.