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; }
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; }
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; }
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; }
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; }