Package org.jivesoftware.smackx.bytestreams.ibb

Examples of org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamSession$IQIBBInputStream


            }

        });

        // get IBB sessions data packet listener
        InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
                        initiatorJID);
        InputStream inputStream = session.getInputStream();
        PacketListener listener = Whitebox.getInternalState(inputStream, PacketListener.class);

        // build data packets
        String base64Data = StringUtils.encodeBase64("Data");
        DataPacketExtension dpe = new DataPacketExtension(sessionID, 0, base64Data);
View Full Code Here


            }

        });

        // get IBB sessions data packet listener
        InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
                        initiatorJID);
        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);
View Full Code Here

        // confirm close request
        protocol.addResponse(resultIQ, Verification.requestTypeSET,
                        Verification.correspondingSenderReceiver);

        // get IBB sessions data packet listener
        InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
                        initiatorJID);
        InputStream inputStream = session.getInputStream();
        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);
View Full Code Here

        rand.nextBytes(controlData);

        IQ resultIQ = IBBPacketUtils.createResultIQ(initiatorJID, targetJID);

        // get IBB sessions data packet listener
        InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
                        initiatorJID);
        InputStream inputStream = session.getInputStream();
        PacketListener listener = Whitebox.getInternalState(inputStream, PacketListener.class);

        // set data packet acknowledgment and notify listener
        for (int i = 0; i < controlData.length / blockSize; i++) {
            protocol.addResponse(resultIQ);
View Full Code Here

        rand.nextBytes(controlData);

        IQ resultIQ = IBBPacketUtils.createResultIQ(initiatorJID, targetJID);

        // get IBB sessions data packet listener
        InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
                        initiatorJID);
        InputStream inputStream = session.getInputStream();
        PacketListener listener = Whitebox.getInternalState(inputStream, PacketListener.class);

        // set data packet acknowledgment and notify listener
        for (int i = 0; i < controlData.length / blockSize; i++) {
            protocol.addResponse(resultIQ);
View Full Code Here

        // acknowledgment for data packet
        IQ resultIQ = IBBPacketUtils.createResultIQ(initiatorJID, targetJID);
        protocol.addResponse(resultIQ);

        // get IBB sessions data packet listener
        InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
                        initiatorJID);
        InputStream inputStream = session.getInputStream();
        PacketListener listener = Whitebox.getInternalState(inputStream, PacketListener.class);

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

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

        inputStream.close();

        protocol.verifyAll();

        try {
            while (inputStream.read() != -1) {
            }
            inputStream.read();
            fail("should throw an exception");
        }
        catch (IOException e) {
            assertTrue(e.getMessage().contains("closed"));
        }

        session.getOutputStream().flush();

    }
View Full Code Here

        // acknowledgment for close request
        protocol.addResponse(resultIQ, Verification.correspondingSenderReceiver,
                        Verification.requestTypeSET);

        // get IBB sessions data packet listener
        InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
                        initiatorJID);
        InputStream inputStream = session.getInputStream();
        PacketListener listener = Whitebox.getInternalState(inputStream, PacketListener.class);

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

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

        session.close();

        protocol.verifyAll();

        try {
            while (inputStream.read() != -1) {
            }
            inputStream.read();
            fail("should throw an exception");
        }
        catch (IOException e) {
            assertTrue(e.getMessage().contains("closed"));
        }

        try {
            session.getOutputStream().flush();
            fail("should throw an exception");
        }
        catch (IOException e) {
            assertTrue(e.getMessage().contains("closed"));
        }
View Full Code Here

        // acknowledgment for data packet
        IQ resultIQ = IBBPacketUtils.createResultIQ(initiatorJID, targetJID);
        protocol.addResponse(resultIQ);

        // get IBB sessions data packet listener
        InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
                        initiatorJID);
        final InputStream inputStream = session.getInputStream();
        PacketListener listener = Whitebox.getInternalState(inputStream, PacketListener.class);

        // build data packet
        String base64Data = StringUtils.encodeBase64("Data");
        DataPacketExtension dpe = new DataPacketExtension(sessionID, 0, base64Data);
View Full Code Here

     *
     * @throws Exception should not happen
     */
    @Test
    public void shouldSendThreeDataPackets1() throws Exception {
        InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
                        initiatorJID);

        // verify the data packets
        protocol.addResponse(null, incrementingSequence);
        protocol.addResponse(null, incrementingSequence);
        protocol.addResponse(null, incrementingSequence);

        byte[] controlData = new byte[blockSize * 3];

        OutputStream outputStream = session.getOutputStream();
        outputStream.write(controlData);
        outputStream.flush();

        protocol.verifyAll();

View Full Code Here

     *
     * @throws Exception should not happen
     */
    @Test
    public void shouldSendThreeDataPackets2() throws Exception {
        InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
                        initiatorJID);

        // verify the data packets
        protocol.addResponse(null, incrementingSequence);
        protocol.addResponse(null, incrementingSequence);
        protocol.addResponse(null, incrementingSequence);

        byte[] controlData = new byte[blockSize * 3];

        OutputStream outputStream = session.getOutputStream();
        for (byte b : controlData) {
            outputStream.write(b);
        }
        outputStream.flush();

View Full Code Here

TOP

Related Classes of org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamSession$IQIBBInputStream

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.