Tabnine Logo
FileTransferNegotiator.negotiateOutgoingTransfer
Code IndexAdd Tabnine to your IDE (free)

How to use
negotiateOutgoingTransfer
method
in
org.jivesoftware.smackx.filetransfer.FileTransferNegotiator

Best Java code snippets using org.jivesoftware.smackx.filetransfer.FileTransferNegotiator.negotiateOutgoingTransfer (Showing top 6 results out of 315)

origin: igniterealtime/Smack

  @Test
  public void verifyForm() throws Exception {
    FileTransferNegotiator fileNeg = FileTransferNegotiator.getInstanceFor(connection);
    try {
      fileNeg.negotiateOutgoingTransfer(JidTestUtil.DUMMY_AT_EXAMPLE_ORG, "streamid", "file", 1024, null, 10);
    } catch (NoResponseException e) {
      // We do not expect an answer. This unit test only checks the request sent.
    }
    Stanza packet = connection.getSentPacket();
    String xml = packet.toXML(null).toString();
    assertTrue(xml.indexOf("var='stream-method' type='list-single'") != -1);
  }
}
origin: igniterealtime/Smack

private OutputStream negotiateStream(String fileName, long fileSize,
    String description) throws SmackException, XMPPException, InterruptedException {
  // Negotiate the file transfer profile
  if (!updateStatus(Status.initial, Status.negotiating_transfer)) {
    throw new IllegalStateChangeException();
  }
  StreamNegotiator streamNegotiator = negotiator.negotiateOutgoingTransfer(
      getPeer(), streamID, fileName, fileSize, description,
      RESPONSE_TIMEOUT);
  // Negotiate the stream
  if (!updateStatus(Status.negotiating_transfer, Status.negotiating_stream)) {
    throw new IllegalStateChangeException();
  }
  outputStream = streamNegotiator.createOutgoingStream(streamID,
      initiator, getPeer());
  if (!updateStatus(Status.negotiating_stream, Status.negotiated)) {
    throw new IllegalStateChangeException();
  }
  return outputStream;
}
origin: org.mobicents.resources/mobicents-slee-ra-xmpp-library

private OutputStream negotiateStream(String fileName, long fileSize,
    String description) throws XMPPException {
  // Negotiate the file transfer profile
  setStatus(Status.NEGOTIATING_TRANSFER);
  StreamNegotiator streamNegotiator = negotiator.negotiateOutgoingTransfer(
      getPeer(), streamID, fileName, fileSize, description,
      RESPONSE_TIMEOUT);
  if (streamNegotiator == null) {
    setStatus(Status.ERROR);
    setError(Error.NO_RESPONSE);
    return null;
  }
  if (!getStatus().equals(Status.NEGOTIATING_TRANSFER)) {
    return null;
  }
  // Negotiate the stream
  setStatus(Status.NEGOTIATING_STREAM);
  outputStream = streamNegotiator.createOutgoingStream(streamID,
      initiator, getPeer());
  if (!getStatus().equals(Status.NEGOTIATING_STREAM)) {
    return null;
  }
  setStatus(Status.NEGOTIATED);
  return outputStream;
}
origin: tiandawu/IotXmpp

private OutputStream negotiateStream(String fileName, long fileSize,
    String description) throws XMPPException {
  // Negotiate the file transfer profile
  if (!updateStatus(Status.initial, Status.negotiating_transfer)) {
    throw new XMPPException("Illegal state change");
  }
  StreamNegotiator streamNegotiator = negotiator.negotiateOutgoingTransfer(
      getPeer(), streamID, fileName, fileSize, description,
      RESPONSE_TIMEOUT);
  if (streamNegotiator == null) {
    setStatus(Status.error);
    setError(Error.no_response);
    return null;
  }
  // Negotiate the stream
  if (!updateStatus(Status.negotiating_transfer, Status.negotiating_stream)) {
    throw new XMPPException("Illegal state change");
  }
  outputStream = streamNegotiator.createOutgoingStream(streamID,
      initiator, getPeer());
  if (!updateStatus(Status.negotiating_stream, Status.negotiated)) {
    throw new XMPPException("Illegal state change");
  }
  return outputStream;
}
origin: org.igniterealtime.smack/smackx

private OutputStream negotiateStream(String fileName, long fileSize,
    String description) throws XMPPException {
  // Negotiate the file transfer profile
  if (!updateStatus(Status.initial, Status.negotiating_transfer)) {
    throw new XMPPException("Illegal state change");
  }
  StreamNegotiator streamNegotiator = negotiator.negotiateOutgoingTransfer(
      getPeer(), streamID, fileName, fileSize, description,
      RESPONSE_TIMEOUT);
  if (streamNegotiator == null) {
    setStatus(Status.error);
    setError(Error.no_response);
    return null;
  }
  // Negotiate the stream
  if (!updateStatus(Status.negotiating_transfer, Status.negotiating_stream)) {
    throw new XMPPException("Illegal state change");
  }
  outputStream = streamNegotiator.createOutgoingStream(streamID,
      initiator, getPeer());
  if (!updateStatus(Status.negotiating_stream, Status.negotiated)) {
    throw new XMPPException("Illegal state change");
  }
  return outputStream;
}
origin: org.littleshoot/smack-xmpp-3-2-2

private OutputStream negotiateStream(String fileName, long fileSize,
    String description) throws XMPPException {
  // Negotiate the file transfer profile
  if (!updateStatus(Status.initial, Status.negotiating_transfer)) {
    throw new XMPPException("Illegal state change");
  }
  StreamNegotiator streamNegotiator = negotiator.negotiateOutgoingTransfer(
      getPeer(), streamID, fileName, fileSize, description,
      RESPONSE_TIMEOUT);
  if (streamNegotiator == null) {
    setStatus(Status.error);
    setError(Error.no_response);
    return null;
  }
  // Negotiate the stream
  if (!updateStatus(Status.negotiating_transfer, Status.negotiating_stream)) {
    throw new XMPPException("Illegal state change");
  }
  outputStream = streamNegotiator.createOutgoingStream(streamID,
      initiator, getPeer());
  if (!updateStatus(Status.negotiating_stream, Status.negotiated)) {
    throw new XMPPException("Illegal state change");
  }
  return outputStream;
}
org.jivesoftware.smackx.filetransferFileTransferNegotiatornegotiateOutgoingTransfer

Javadoc

Send a request to another user to send them a file. The other user has the option of, accepting, rejecting, or not responding to a received file transfer request.

If they accept, the packet will contain the other user's chosen stream type to send the file across. The two choices this implementation provides to the other user for file transfer are SOCKS5 Bytestreams, which is the preferred method of transfer, and In-Band Bytestreams, which is the fallback mechanism.

The other user may choose to decline the file request if they do not desire the file, their client does not support JEP-0096, or if there are no acceptable means to transfer the file.

Finally, if the other user does not respond this method will return null after the specified timeout.

Popular methods of FileTransferNegotiator

  • getInstanceFor
    Returns the file transfer negotiator related to a particular connection. When this class is requeste
  • <init>
  • createDefaultInitiationForm
  • getNegotiator
  • getNextStreamID
    Returns a new, unique, stream ID to identify a file transfer.
  • getOutgoingNegotiator
  • getStreamMethodField
  • selectStreamNegotiator
    Selects an appropriate stream negotiator after examining the incoming file transfer request.
  • setServiceEnabled
    Enable the Jabber services related to file transfer on the particular connection.
  • configureConnection
  • createIQ
    A convience method to create an IQ packet.
  • connection
  • createIQ,
  • connection

Popular in Java

  • Making http post requests using okhttp
  • getApplicationContext (Context)
  • startActivity (Activity)
  • getExternalFilesDir (Context)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • JFileChooser (javax.swing)
  • Runner (org.openjdk.jmh.runner)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now