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

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


*/
public class CloseTest {

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


        new Close(null);
    }

    @Test(expected = IllegalArgumentException.class)
    public void shouldNotInstantiateWithInvalidArguments2() {
        new Close("");
    }
View Full Code Here

        new Close("");
    }

    @Test
    public void shouldBeOfIQTypeSET() {
        Close close = new Close("sessionID");
        assertEquals(IQ.Type.SET, close.getType());
    }
View Full Code Here

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

    @Test
    public void shouldSetAllFieldsCorrectly() {
        Close close = new Close("sessionID");
        assertEquals("sessionID", close.getSessionID());
    }
View Full Code Here

            .e("close")
                .a("xmlns", "http://jabber.org/protocol/ibb")
                .a("sid", "i781hf64")
            .asString(outputProperties);

        Close close = new Close("i781hf64");
        close.setFrom("romeo@montague.lit/orchard");
        close.setTo("juliet@capulet.lit/balcony");
        close.setPacketID("us71g45j");
       
        assertXMLEqual(control, close.toXML());
    }
View Full Code Here

    protected CloseListener(InBandBytestreamManager manager) {
        this.manager = manager;
    }

    public void processPacket(Packet packet) {
        Close closeRequest = (Close) packet;
        InBandBytestreamSession ibbSession = this.manager.getSessions().get(
                        closeRequest.getSessionID());
        if (ibbSession == null) {
            this.manager.replyItemNotFoundPacket(closeRequest);
        }
        else {
            ibbSession.closeByPeer(closeRequest);
            this.manager.getSessions().remove(closeRequest.getSessionID());
        }

    }
View Full Code Here

        if (this.inputStream.isClosed && this.outputStream.isClosed) {
            this.isClosed = true;

            // send close request
            Close close = new Close(this.byteStreamRequest.getSessionID());
            close.setTo(this.remoteJID);
            try {
                SyncPacketSend.getReply(this.connection, close);
            }
            catch (XMPPException e) {
                throw new IOException("Error while closing stream: " + e.getMessage());
View Full Code Here

        // get the CloseListener from InBandByteStreamManager
        CloseListener closeListener = Whitebox.getInternalState(byteStreamManager,
                        CloseListener.class);

        Close close = new Close("unknownSessionId");
        close.setFrom(initiatorJID);
        close.setTo(targetJID);

        closeListener.processPacket(close);

        // wait because packet is processed in an extra thread
        Thread.sleep(200);
View Full Code Here

*/
public class CloseIQProvider implements IQProvider {

    public IQ parseIQ(XmlPullParser parser) throws Exception {
        String sid = parser.getAttributeValue("", "sid");
        return new Close(sid);
    }
View Full Code Here

        if (this.inputStream.isClosed && this.outputStream.isClosed) {
            this.isClosed = true;

            // send close request
            Close close = new Close(this.byteStreamRequest.getSessionID());
            close.setTo(this.remoteJID);
            try {
                SyncPacketSend.getReply(this.connection, close);
            }
            catch (XMPPException e) {
                throw new IOException("Error while closing stream: " + e.getMessage());
View Full Code Here

TOP

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

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.