Java 类org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamManager 实例源码

项目:lider    文件:XMPPClientImpl.java   
/**
 * Send file to provided JID via a SOCKS5 Bytestream session (XEP-0065).
 * 
 * @param file
 * @param jid
 * @throws SmackException
 * @throws InterruptedException
 * @throws IOException
 * @throws XMPPException
 */
public void sendFile(byte[] file, String jid)
        throws XMPPException, IOException, InterruptedException, SmackException {
    String jidFinal = getFullJid(jid);
    jidFinal += "/receiver";
    Socks5BytestreamManager bytestreamManager = Socks5BytestreamManager.getBytestreamManager(connection);
    OutputStream outputStream = null;
    try {
        Socks5BytestreamSession session = bytestreamManager.establishSession(jidFinal);
        outputStream = session.getOutputStream();
        outputStream.write(file);
        outputStream.flush();
    } finally {
        if (outputStream != null) {
            try {
                outputStream.close();
            } catch (IOException e) {
                logger.error(e.getMessage(), e);
            }
        }
    }
}
项目:EIM    文件:FileTransferNegotiator.java   
/**
 * Enable the Jabber services related to file transfer on the particular
 * connection.
 *
 * @param connection The connection on which to enable or disable the services.
 * @param isEnabled  True to enable, false to disable.
 */
public static void setServiceEnabled(final Connection connection,
        final boolean isEnabled) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (isEnabled) {
            if (!manager.includesFeature(namespace)) {
                manager.addFeature(namespace);
            }
        } else {
            manager.removeFeature(namespace);
        }
    }

}
项目:EIM    文件:FileTransferNegotiator.java   
/**
 * Checks to see if all file transfer related services are enabled on the
 * connection.
 *
 * @param connection The connection to check
 * @return True if all related services are enabled, false if they are not.
 */
public static boolean isServiceEnabled(final Connection connection) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (!manager.includesFeature(namespace)) {
            return false;
        }
    }
    return true;
}
项目:androidPN-client.    文件:FileTransferNegotiator.java   
/**
 * Enable the Jabber services related to file transfer on the particular
 * connection.
 *
 * @param connection The connection on which to enable or disable the services.
 * @param isEnabled  True to enable, false to disable.
 */
public static void setServiceEnabled(final Connection connection,
        final boolean isEnabled) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (isEnabled) {
            if (!manager.includesFeature(namespace)) {
                manager.addFeature(namespace);
            }
        } else {
            manager.removeFeature(namespace);
        }
    }

}
项目:androidPN-client.    文件:FileTransferNegotiator.java   
/**
 * Checks to see if all file transfer related services are enabled on the
 * connection.
 *
 * @param connection The connection to check
 * @return True if all related services are enabled, false if they are not.
 */
public static boolean isServiceEnabled(final Connection connection) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (!manager.includesFeature(namespace)) {
            return false;
        }
    }
    return true;
}
项目:xmppsupport_v2    文件:FileTransferNegotiator.java   
/**
 * Enable the Jabber services related to file transfer on the particular
 * connection.
 * 
 * @param connection
 *            The connection on which to enable or disable the services.
 * @param isEnabled
 *            True to enable, false to disable.
 */
public static void setServiceEnabled(final Connection connection,
        final boolean isEnabled) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (isEnabled) {
            if (!manager.includesFeature(namespace)) {
                manager.addFeature(namespace);
            }
        } else {
            manager.removeFeature(namespace);
        }
    }

}
项目:xmppsupport_v2    文件:FileTransferNegotiator.java   
/**
 * Checks to see if all file transfer related services are enabled on the
 * connection.
 * 
 * @param connection
 *            The connection to check
 * @return True if all related services are enabled, false if they are not.
 */
public static boolean isServiceEnabled(final Connection connection) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (!manager.includesFeature(namespace)) {
            return false;
        }
    }
    return true;
}
项目:java-bells    文件:FileTransferNegotiator.java   
/**
 * Enable the Jabber services related to file transfer on the particular
 * connection.
 *
 * @param connection The connection on which to enable or disable the services.
 * @param isEnabled  True to enable, false to disable.
 */
public static void setServiceEnabled(final Connection connection,
        final boolean isEnabled) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (isEnabled) {
            if (!manager.includesFeature(namespace)) {
                manager.addFeature(namespace);
            }
        } else {
            manager.removeFeature(namespace);
        }
    }

}
项目:java-bells    文件:FileTransferNegotiator.java   
/**
 * Checks to see if all file transfer related services are enabled on the
 * connection.
 *
 * @param connection The connection to check
 * @return True if all related services are enabled, false if they are not.
 */
public static boolean isServiceEnabled(final Connection connection) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (!manager.includesFeature(namespace)) {
            return false;
        }
    }
    return true;
}
项目:telegraph    文件:FileTransferNegotiator.java   
/**
 * Enable the Jabber services related to file transfer on the particular
 * connection.
 *
 * @param connection The connection on which to enable or disable the services.
 * @param isEnabled  True to enable, false to disable.
 */
public static void setServiceEnabled(final Connection connection,
        final boolean isEnabled) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (isEnabled) {
            if (!manager.includesFeature(namespace)) {
                manager.addFeature(namespace);
            }
        } else {
            manager.removeFeature(namespace);
        }
    }

}
项目:telegraph    文件:FileTransferNegotiator.java   
/**
 * Checks to see if all file transfer related services are enabled on the
 * connection.
 *
 * @param connection The connection to check
 * @return True if all related services are enabled, false if they are not.
 */
public static boolean isServiceEnabled(final Connection connection) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (!manager.includesFeature(namespace)) {
            return false;
        }
    }
    return true;
}
项目:Smack    文件:Socks5ByteStreamTest.java   
/**
 * Socks5 feature should be added to the service discovery on Smack startup.
 * 
 * @throws XMPPException should not happen
 */
public void testInitializationSocks5FeaturesAndListenerOnStartup() throws XMPPException {
    XMPPConnection connection = getConnection(0);

    assertTrue(ServiceDiscoveryManager.getInstanceFor(connection).includesFeature(
                    Socks5BytestreamManager.NAMESPACE));

}
项目:EIM    文件:FileTransferNegotiator.java   
/**
 * Returns a collection of the supported transfer protocols.
 *
 * @return Returns a collection of the supported transfer protocols.
 */
public static Collection<String> getSupportedProtocols() {
    List<String> protocols = new ArrayList<String>();
    protocols.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        protocols.add(Socks5BytestreamManager.NAMESPACE);
    }
    return Collections.unmodifiableList(protocols);
}
项目:EIM    文件:FileTransferNegotiator.java   
private StreamNegotiator getNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<FormField.Option> it = field.getOptions(); it.hasNext();) {
        variable = it.next().getValue();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        }
        else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

    if (isByteStream && isIBB && field.getType().equals(FormField.TYPE_LIST_MULTI)) {
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager,
                inbandTransferManager);
    }
    else if (isByteStream) {
        return byteStreamTransferManager;
    }
    else {
        return inbandTransferManager;
    }
}
项目:EIM    文件:FileTransferNegotiator.java   
private StreamNegotiator getOutgoingNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<String> it = field.getValues(); it.hasNext();) {
        variable = it.next();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        }
        else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

    if (isByteStream && isIBB) {
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager, inbandTransferManager);
    }
    else if (isByteStream) {
        return byteStreamTransferManager;
    }
    else {
        return inbandTransferManager;
    }
}
项目:EIM    文件:FileTransferNegotiator.java   
private DataForm createDefaultInitiationForm() {
    DataForm form = new DataForm(Form.TYPE_FORM);
    FormField field = new FormField(STREAM_DATA_FIELD_NAME);
    field.setType(FormField.TYPE_LIST_MULTI);
    if (!IBB_ONLY) {
        field.addOption(new FormField.Option(Socks5BytestreamManager.NAMESPACE));
    }
    field.addOption(new FormField.Option(InBandBytestreamManager.NAMESPACE));
    form.addField(field);
    return form;
}
项目:androidPN-client.    文件:FileTransferNegotiator.java   
/**
 * Returns a collection of the supported transfer protocols.
 *
 * @return Returns a collection of the supported transfer protocols.
 */
public static Collection<String> getSupportedProtocols() {
    List<String> protocols = new ArrayList<String>();
    protocols.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        protocols.add(Socks5BytestreamManager.NAMESPACE);
    }
    return Collections.unmodifiableList(protocols);
}
项目:androidPN-client.    文件:FileTransferNegotiator.java   
private StreamNegotiator getNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<FormField.Option> it = field.getOptions(); it.hasNext();) {
        variable = it.next().getValue();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        }
        else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

   //if (isByteStream && isIBB && field.getType().equals(FormField.TYPE_LIST_MULTI)) {
    if (isByteStream && isIBB) { 
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager,
                inbandTransferManager);
    }
    else if (isByteStream) {
        return byteStreamTransferManager;
    }
    else {
        return inbandTransferManager;
    }
}
项目:androidPN-client.    文件:FileTransferNegotiator.java   
private StreamNegotiator getOutgoingNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<String> it = field.getValues(); it.hasNext();) {
        variable = it.next();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        }
        else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

    if (isByteStream && isIBB) {
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager, inbandTransferManager);
    }
    else if (isByteStream) {
        return byteStreamTransferManager;
    }
    else {
        return inbandTransferManager;
    }
}
项目:androidPN-client.    文件:FileTransferNegotiator.java   
private DataForm createDefaultInitiationForm() {
    DataForm form = new DataForm(Form.TYPE_FORM);
    FormField field = new FormField(STREAM_DATA_FIELD_NAME);
    field.setType(FormField.TYPE_LIST_SINGLE);
    if (!IBB_ONLY) {
        field.addOption(new FormField.Option(Socks5BytestreamManager.NAMESPACE));
    }
    field.addOption(new FormField.Option(InBandBytestreamManager.NAMESPACE));
    form.addField(field);
    return form;
}
项目:xmppsupport_v2    文件:FileTransferNegotiator.java   
/**
 * Returns a collection of the supported transfer protocols.
 * 
 * @return Returns a collection of the supported transfer protocols.
 */
public static Collection<String> getSupportedProtocols() {
    List<String> protocols = new ArrayList<String>();
    protocols.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        protocols.add(Socks5BytestreamManager.NAMESPACE);
    }
    return Collections.unmodifiableList(protocols);
}
项目:xmppsupport_v2    文件:FileTransferNegotiator.java   
private StreamNegotiator getNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<FormField.Option> it = field.getOptions(); it.hasNext();) {
        variable = it.next().getValue();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        } else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

    // if (isByteStream && isIBB &&
    // field.getType().equals(FormField.TYPE_LIST_MULTI)) {
    if (isByteStream && isIBB) {
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager, inbandTransferManager);
    } else if (isByteStream) {
        return byteStreamTransferManager;
    } else {
        return inbandTransferManager;
    }
}
项目:xmppsupport_v2    文件:FileTransferNegotiator.java   
private StreamNegotiator getOutgoingNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<String> it = field.getValues(); it.hasNext();) {
        variable = it.next();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        } else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

    if (isByteStream || isIBB) {
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager, inbandTransferManager);
    } else if (isByteStream) {
        return byteStreamTransferManager;
    } else {
        return inbandTransferManager;
    }
}
项目:xmppsupport_v2    文件:FileTransferNegotiator.java   
private DataForm createDefaultInitiationForm() {
    DataForm form = new DataForm(Form.TYPE_FORM);
    FormField field = new FormField(STREAM_DATA_FIELD_NAME);
    field.setType(FormField.TYPE_LIST_SINGLE);
    if (!IBB_ONLY) {
        field.addOption(new FormField.Option(
                Socks5BytestreamManager.NAMESPACE));
    }
    field.addOption(new FormField.Option(InBandBytestreamManager.NAMESPACE));
    form.addField(field);
    return form;
}
项目:maxs    文件:XMPPFileTransfer.java   
@Override
public void newConnection(XMPPConnection connection) {
    // disable streamhost prioritization
    Socks5BytestreamManager s5bsm = Socks5BytestreamManager.getBytestreamManager(connection);
    s5bsm.setProxyPrioritizationEnabled(false);
    sFileTransferManager = FileTransferManager.getInstanceFor(connection);
    sFileTransferManager.addFileTransferListener(this);
}
项目:java-bells    文件:FileTransferNegotiator.java   
/**
 * Returns a collection of the supported transfer protocols.
 *
 * @return Returns a collection of the supported transfer protocols.
 */
public static Collection<String> getSupportedProtocols() {
    List<String> protocols = new ArrayList<String>();
    protocols.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        protocols.add(Socks5BytestreamManager.NAMESPACE);
    }
    return Collections.unmodifiableList(protocols);
}
项目:java-bells    文件:FileTransferNegotiator.java   
private StreamNegotiator getNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<FormField.Option> it = field.getOptions(); it.hasNext();) {
        variable = it.next().getValue();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        }
        else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

   //if (isByteStream && isIBB && field.getType().equals(FormField.TYPE_LIST_MULTI)) {
    if (isByteStream && isIBB) { 
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager,
                inbandTransferManager);
    }
    else if (isByteStream) {
        return byteStreamTransferManager;
    }
    else {
        return inbandTransferManager;
    }
}
项目:java-bells    文件:FileTransferNegotiator.java   
private StreamNegotiator getOutgoingNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<String> it = field.getValues(); it.hasNext();) {
        variable = it.next();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        }
        else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

    if (isByteStream && isIBB) {
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager, inbandTransferManager);
    }
    else if (isByteStream) {
        return byteStreamTransferManager;
    }
    else {
        return inbandTransferManager;
    }
}
项目:java-bells    文件:FileTransferNegotiator.java   
private DataForm createDefaultInitiationForm() {
    DataForm form = new DataForm(Form.TYPE_FORM);
    FormField field = new FormField(STREAM_DATA_FIELD_NAME);
    field.setType(FormField.TYPE_LIST_SINGLE);
    if (!IBB_ONLY) {
        field.addOption(new FormField.Option(Socks5BytestreamManager.NAMESPACE));
    }
    field.addOption(new FormField.Option(InBandBytestreamManager.NAMESPACE));
    form.addField(field);
    return form;
}
项目:java-bells    文件:Socks5ByteStreamTest.java   
/**
 * Socks5 feature should be added to the service discovery on Smack startup.
 * 
 * @throws XMPPException should not happen
 */
public void testInitializationSocks5FeaturesAndListenerOnStartup() throws XMPPException {
    Connection connection = getConnection(0);

    assertTrue(ServiceDiscoveryManager.getInstanceFor(connection).includesFeature(
                    Socks5BytestreamManager.NAMESPACE));

}
项目:telegraph    文件:FileTransferNegotiator.java   
/**
 * Returns a collection of the supported transfer protocols.
 *
 * @return Returns a collection of the supported transfer protocols.
 */
public static Collection<String> getSupportedProtocols() {
    List<String> protocols = new ArrayList<String>();
    protocols.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        protocols.add(Socks5BytestreamManager.NAMESPACE);
    }
    return Collections.unmodifiableList(protocols);
}
项目:telegraph    文件:FileTransferNegotiator.java   
private StreamNegotiator getNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<FormField.Option> it = field.getOptions(); it.hasNext();) {
        variable = it.next().getValue();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        }
        else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

   //if (isByteStream && isIBB && field.getType().equals(FormField.TYPE_LIST_MULTI)) {
    if (isByteStream && isIBB) { 
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager,
                inbandTransferManager);
    }
    else if (isByteStream) {
        return byteStreamTransferManager;
    }
    else {
        return inbandTransferManager;
    }
}
项目:telegraph    文件:FileTransferNegotiator.java   
private StreamNegotiator getOutgoingNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<String> it = field.getValues(); it.hasNext();) {
        variable = it.next();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        }
        else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

    if (isByteStream && isIBB) {
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager, inbandTransferManager);
    }
    else if (isByteStream) {
        return byteStreamTransferManager;
    }
    else {
        return inbandTransferManager;
    }
}
项目:telegraph    文件:FileTransferNegotiator.java   
private DataForm createDefaultInitiationForm() {
    DataForm form = new DataForm(Form.TYPE_FORM);
    FormField field = new FormField(STREAM_DATA_FIELD_NAME);
    field.setType(FormField.TYPE_LIST_SINGLE);
    if (!IBB_ONLY) {
        field.addOption(new FormField.Option(Socks5BytestreamManager.NAMESPACE));
    }
    field.addOption(new FormField.Option(InBandBytestreamManager.NAMESPACE));
    form.addField(field);
    return form;
}
项目:Smack    文件:Socks5TransferNegotiator.java   
Socks5TransferNegotiator(XMPPConnection connection) {
    this.connection = connection;
    this.manager = Socks5BytestreamManager.getBytestreamManager(this.connection);
}
项目:Smack    文件:Socks5TransferNegotiator.java   
private ByteStreamRequest(Socks5BytestreamManager manager, Bytestream byteStreamRequest) {
    super(manager, byteStreamRequest);
}
项目:EIM    文件:Socks5TransferNegotiator.java   
Socks5TransferNegotiator(Connection connection) {
    this.connection = connection;
    this.manager = Socks5BytestreamManager.getBytestreamManager(this.connection);
}
项目:EIM    文件:Socks5TransferNegotiator.java   
@Override
public String[] getNamespaces() {
    return new String[] { Socks5BytestreamManager.NAMESPACE };
}
项目:EIM    文件:Socks5TransferNegotiator.java   
private ByteStreamRequest(Socks5BytestreamManager manager, Bytestream byteStreamRequest) {
    super(manager, byteStreamRequest);
}
项目:androidPN-client.    文件:Socks5TransferNegotiator.java   
Socks5TransferNegotiator(Connection connection) {
    this.connection = connection;
    this.manager = Socks5BytestreamManager.getBytestreamManager(this.connection);
}