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(BYTE_STREAM) && !IBB_ONLY) {
                isByteStream = true;
            }
            else if (variable.equals(INBAND_BYTE_STREAM)) {
                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.createNegotiator(), inbandTransferManager);
        }
        else if (isByteStream) {
            return byteStreamTransferManager.createNegotiator();
        }
        else {
            return inbandTransferManager;
        }
    }