Examples of ByteStream


Examples of org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream

        // start a local SOCKS5 proxy
        Socks5TestProxy socks5Proxy = Socks5TestProxy.getProxy(7778);

        // build SOCKS5 Bytestream initialization request
        Bytestream bytestreamInitialization = Socks5PacketUtils.createBytestreamInitiation(
                        initiatorJID, targetJID, sessionID);
        bytestreamInitialization.addStreamHost(proxyJID, proxyAddress, 7778);

        // create test data for stream
        byte[] data = new byte[] { 1, 2, 3 };

        // get SOCKS5 Bytestream manager for connection
View Full Code Here

Examples of org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream

     * @param to the target
     * @param sessionID the session ID
     * @return SOCKS5 Bytestream initialization request packet
     */
    public static Bytestream createBytestreamInitiation(String from, String to, String sessionID) {
        Bytestream bytestream = new Bytestream();
        bytestream.getPacketID();
        bytestream.setFrom(from);
        bytestream.setTo(to);
        bytestream.setSessionID(sessionID);
        bytestream.setType(IQ.Type.SET);
        return bytestream;
    }
View Full Code Here

Examples of org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream

     * @param from the target
     * @param to the initiator
     * @return response to a SOCKS5 Bytestream initialization request
     */
    public static Bytestream createBytestreamResponse(String from, String to) {
        Bytestream streamHostInfo = new Bytestream();
        streamHostInfo.getPacketID();
        streamHostInfo.setFrom(from);
        streamHostInfo.setTo(to);
        streamHostInfo.setType(IQ.Type.RESULT);
        return streamHostInfo;
    }
View Full Code Here

Examples of org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream

            // add transfer digest to local proxy to make transfer valid
            socks5Proxy.addTransfer(digest);

            // create initiation packet
            Bytestream initiation = createBytestreamInitiation(sessionID, targetJID, streamHosts);

            // send initiation packet
            Packet response = SyncPacketSend.getReply(this.connection, initiation,
                            getTargetResponseTimeout());

            // extract used stream host from response
            StreamHostUsed streamHostUsed = ((Bytestream) response).getUsedHost();
            StreamHost usedStreamHost = initiation.getStreamHost(streamHostUsed.getJID());

            if (usedStreamHost == null) {
                throw new XMPPException("Remote user responded with unknown host");
            }
View Full Code Here

Examples of org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream

            streamHosts.addAll(localProxies);
        }

        // query SOCKS5 proxies for network settings
        for (String proxy : proxies) {
            Bytestream streamHostRequest = createStreamHostRequest(proxy);
            try {
                Bytestream response = (Bytestream) SyncPacketSend.getReply(this.connection,
                                streamHostRequest);
                streamHosts.addAll(response.getStreamHosts());
            }
            catch (XMPPException e) {
                // blacklist errornous proxies
                this.proxyBlacklist.add(proxy);
            }
View Full Code Here

Examples of org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream

     *
     * @param proxy the proxy to query
     * @return IQ packet to query a SOCKS5 proxy its network settings
     */
    private Bytestream createStreamHostRequest(String proxy) {
        Bytestream request = new Bytestream();
        request.setType(IQ.Type.GET);
        request.setTo(proxy);
        return request;
    }
View Full Code Here

Examples of org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream

     * @param streamHosts a list of SOCKS5 proxies the target should connect to
     * @return a SOCKS5 Bytestream initialization request packet
     */
    private Bytestream createBytestreamInitiation(String sessionID, String targetJID,
                    List<StreamHost> streamHosts) {
        Bytestream initiation = new Bytestream(sessionID);

        // add all stream hosts
        for (StreamHost streamHost : streamHosts) {
            initiation.addStreamHost(streamHost);
        }

        initiation.setType(IQ.Type.SET);
        initiation.setTo(targetJID);

        return initiation;
    }
View Full Code Here

Examples of org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream

    /**
     * Activates the SOCKS5 Bytestream by sending a XMPP SOCKS5 Bytestream activation packet to the
     * SOCKS5 proxy.
     */
    private void activate() throws XMPPException {
        Bytestream activate = createStreamHostActivation();
        // if activation fails #getReply throws an exception
        SyncPacketSend.getReply(this.connection, activate);
    }
View Full Code Here

Examples of org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream

     * Returns a SOCKS5 Bytestream activation packet.
     *
     * @return SOCKS5 Bytestream activation packet
     */
    private Bytestream createStreamHostActivation() {
        Bytestream activate = new Bytestream(this.sessionID);
        activate.setMode(null);
        activate.setType(IQ.Type.SET);
        activate.setTo(this.streamHost.getJID());

        activate.setToActivate(this.target);

        return activate;
    }
View Full Code Here

Examples of org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream

        if (selectedHost == null || socket == null) {
            cancelRequest();
        }

        // send used-host confirmation
        Bytestream response = createUsedHostResponse(selectedHost);
        this.manager.getConnection().sendPacket(response);

        return new Socks5BytestreamSession(socket, selectedHost.getJID().equals(
                        this.bytestreamRequest.getFrom()));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.