field.getOptions().add(new DataForm.Option(streamMethod));
}
dataForm.getFields().add(field);
// Offer the file to the recipient and wait until it's accepted.
IQ result = xmppSession.query(new IQ(receiver, IQ.Type.SET, new StreamInitiation(sessionId, SIFileTransferOffer.NAMESPACE, mimeType, profile, new FeatureNegotiation(dataForm))), timeout);
// The recipient must response with a stream initiation.
StreamInitiation streamInitiation = result.getExtension(StreamInitiation.class);
FeatureNegotiation featureNegotiation = streamInitiation.getFeatureNegotiation();
// Get the stream method which has been chosen by the recipient.
String streamMethod = featureNegotiation.getDataForm().findField(STREAM_METHOD).getValues().get(0);
ByteStreamSession byteStreamSession;
// Choose the stream method to be used based on the recipient's choice.
switch (streamMethod) {
case Socks5ByteStream.NAMESPACE: