Package org.jivesoftware.smackx.jingle

Examples of org.jivesoftware.smackx.jingle.JingleSession


    /**
     * Initialize the screen share channels.
     */
    public void initialize() {

        JingleSession session = getJingleSession();
        if ((session != null) && (session.getInitiator().equals(session.getConnection().getUser()))) {
            // If the initiator of the jingle session is us then we transmit a screen share.
            try {
                InetAddress remote = InetAddress.getByName(getRemote().getIp());
                transmitter = new ImageTransmitter(new DatagramSocket(getLocal().getPort()), remote, getRemote().getPort(),
                        new Rectangle(0, 0, width, height));
View Full Code Here


    public synchronized IBytestreamConnection connect(JID peer,
        SubMonitor progress) throws IOException, InterruptedException {

        progress.subTask("Try to initiate bytestream with " + toString());

        JingleSession out = null;
        try {
            out = manager.createOutgoingJingleSession(peer.toString());
            out.startOutgoing();
            waitForConnection(out);
        } catch (XMPPException e) {
            log.error("Could not connect to " + peer.toString());
            return null;
        }
View Full Code Here

                 */
                public void sessionRequested(final JingleSessionRequest request) {
                    System.out.println("Session request detected, from " + request.getFrom() + ": accepting.");

                    // We accept the request
                    JingleSession session1;
                    try {
                        session1 = request.accept();
                        session1.addListener(new JingleSessionListener() {
                            public void sessionClosed(String reason, JingleSession jingleSession) {
                            }

                            public void sessionClosedOnError(XMPPException e, JingleSession jingleSession) {
                            }

                            public void sessionDeclined(String reason, JingleSession jingleSession) {
                            }

                            public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc,
                                    JingleSession jingleSession) {
                                incCounter();
                                System.out.println("Responder: the session is fully established.");
                                System.out.println("+ Payload Type: " + pt.getId());
                                System.out.println("+ Local IP/port: " + lc.getIp() + ":" + lc.getPort());
                                System.out.println("+ Remote IP/port: " + rc.getIp() + ":" + rc.getPort());
                            }

                            public void sessionRedirected(String redirection, JingleSession jingleSession) {
                            }

                            public void sessionMediaReceived(JingleSession jingleSession, String participant) {
                                // Do Nothing
                            }
                        });
                        session1.startIncoming();
                    } catch (XMPPException e) {
                        e.printStackTrace();
                    }
                }
            });

            // Session 0 starts a request
            System.out.println("Starting session request, to " + getFullJID(1) + "...");
            JingleSession session0 = man0.createOutgoingJingleSession(getFullJID(1));

            session0.addListener(new JingleSessionListener() {
                public void sessionClosed(String reason, JingleSession jingleSession) {
                }

                public void sessionClosedOnError(XMPPException e, JingleSession jingleSession) {
                }

                public void sessionDeclined(String reason, JingleSession jingleSession) {
                }

                public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc,
                        JingleSession jingleSession) {
                    incCounter();
                    System.out.println("Initiator: the session is fully established.");
                    System.out.println("+ Payload Type: " + pt.getId());
                    System.out.println("+ Local IP/port: " + lc.getIp() + ":" + lc.getPort());
                    System.out.println("+ Remote IP/port: " + rc.getIp() + ":" + rc.getPort());
                }

                public void sessionMediaReceived(JingleSession jingleSession, String participant) {
                    // Do Nothing
                }

                public void sessionRedirected(String redirection, JingleSession jingleSession) {
                }
            });
            session0.startOutgoing();

            Thread.sleep(60000);

            assertTrue(valCounter() == 2);

View Full Code Here

TOP

Related Classes of org.jivesoftware.smackx.jingle.JingleSession

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.