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

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


        assertEquals(IQ.Type.SET, open.getType());
    }

    @Test
    public void shouldSetAllFieldsCorrectly() {
        Open open = new Open("sessionID", 4096, StanzaType.MESSAGE);
        assertEquals("sessionID", open.getSessionID());
        assertEquals(4096, open.getBlockSize());
        assertEquals(StanzaType.MESSAGE, open.getStanza());
    }
View Full Code Here


                .a("block-size", "4096")
                .a("sid", "i781hf64")
                .a("stanza", "iq")
            .asString(outputProperties);

        Open open = new Open("i781hf64", 4096, StanzaType.IQ);
        open.setFrom("romeo@montague.lit/orchard");
        open.setTo("juliet@capulet.lit/balcony");
        open.setPacketID("jn3h8g65");
       
        assertXMLEqual(control, open.toXML());
    }
View Full Code Here

     * @throws XMPPException if the user doesn't support or accept in-band bytestreams, or if the
     *         user prefers smaller block sizes
     */
    public InBandBytestreamSession establishSession(String targetJID, String sessionID)
                    throws XMPPException {
        Open byteStreamRequest = new Open(sessionID, this.defaultBlockSize, this.stanza);
        byteStreamRequest.setTo(targetJID);

        // sending packet will throw exception on timeout or error reply
        SyncPacketSend.getReply(this.connection, byteStreamRequest);

        InBandBytestreamSession inBandBytestreamSession = new InBandBytestreamSession(
View Full Code Here

            }
        });
    }

    private void processRequest(Packet packet) {
        Open ibbRequest = (Open) packet;

        // validate that block size is within allowed range
        if (ibbRequest.getBlockSize() > this.manager.getMaximumBlockSize()) {
            this.manager.replyResourceConstraintPacket(ibbRequest);
            return;
        }

        // ignore request if in ignore list
        if (this.manager.getIgnoredBytestreamRequests().remove(ibbRequest.getSessionID()))
            return;

        // build bytestream request from packet
        InBandBytestreamRequest request = new InBandBytestreamRequest(this.manager, ibbRequest);

        // notify listeners for bytestream initiation from a specific user
        BytestreamListener userListener = this.manager.getUserListener(ibbRequest.getFrom());
        if (userListener != null) {
            userListener.incomingBytestreamRequest(request);

        }
        else if (!this.manager.getAllRequestListeners().isEmpty()) {
View Full Code Here

        // initialize InBandBytestreamManager to get the InitiationListener
        byteStreamManager = InBandBytestreamManager.getByteStreamManager(connection);

        // create a In-Band Bytestream open packet
        initBytestream = new Open(sessionID, 4096);
        initBytestream.setFrom(initiatorJID);
        initBytestream.setTo(targetJID);

    }
View Full Code Here

        // get the InitiationListener from InBandByteStreamManager
        initiationListener = Whitebox.getInternalState(byteStreamManager, InitiationListener.class);

        // create a In-Band Bytestream open packet
        initBytestream = new Open(sessionID, 4096);
        initBytestream.setFrom(initiatorJID);
        initBytestream.setTo(targetJID);

    }
View Full Code Here

    public void testRespondWithErrorOnInBandBytestreamRequest() throws XMPPException {
        Connection targetConnection = getConnection(0);

        Connection initiatorConnection = getConnection(1);

        Open open = new Open("sessionID", 1024);
        open.setFrom(initiatorConnection.getUser());
        open.setTo(targetConnection.getUser());

        PacketCollector collector = initiatorConnection.createPacketCollector(new PacketIDFilter(
                        open.getPacketID()));
        initiatorConnection.sendPacket(open);
        Packet result = collector.nextResult();

        assertNotNull(result.getError());
        assertEquals(XMPPError.Condition.no_acceptable.toString(), result.getError().getCondition());
View Full Code Here

        }
        else {
            stanza = StanzaType.valueOf(stanzaValue.toUpperCase());
        }

        return new Open(sessionID, blockSize, stanza);
    }
View Full Code Here

            this.sessionID = sessionID;
        }

        public boolean accept(Packet packet) {
            if (super.accept(packet)) {
                Open bytestream = (Open) packet;

                // packet must by of type SET and contains the given session ID
                return this.sessionID.equals(bytestream.getSessionID())
                                && IQ.Type.SET.equals(bytestream.getType());
            }
            return false;
        }
View Full Code Here

            this.sessionID = sessionID;
        }

        public boolean accept(Packet packet) {
            if (super.accept(packet)) {
                Open bytestream = (Open) packet;

                // packet must by of type SET and contains the given session ID
                return this.sessionID.equals(bytestream.getSessionID())
                                && IQ.Type.SET.equals(bytestream.getType());
            }
            return false;
        }
View Full Code Here

TOP

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

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.