title: Android File Transfer not working via XMPP and OpenFire
body: <p><strong>Problem</strong> : Can't receive a file sent to my android app via XMPP and OpenFire Server. I can successfully send a file though. The asmack jar I am using is <em>asmack-jse-buddycloud-2010.12.11.jar</em></p>
  
  <p><strong>Code</strong> :</p>
  
  <pre><code>    connConfig = new ConnectionConfiguration("beta.myCompany.co.uk", 5222);
      connConfig.setSASLAuthenticationEnabled(true);
      try {
          connect("username", "password");
      } catch (Exception e) {
          e.printStackTrace();
      }
  
      ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
      if(sdm == null)
          sdm = new ServiceDiscoveryManager(connection);
  
      fileTransferManager = new FileTransferManager(connection);
      FileTransferNegotiator.setServiceEnabled(connection, true);
  
  fileTransferManager.addFileTransferListener(new FileTransferListener() {
      @Override
      public void fileTransferRequest(FileTransferRequest request) {
          IncomingFileTransfer transfer = request.accept();
          try {
              FileOutputStream fos = openFileOutput(request.getFileName(), Context.MODE_PRIVATE);
              InputStream stream = transfer.recieveFile();//THIS FAILS!
              fos.write(IOUtils.toByteArray(stream));
              fos.close();    
          } catch (Exception e) {
              e.printStackTrace();
          }
  }
  </code></pre>
  
  <p><strong>Error (<em>If file is sent via Spark</em>)</strong> :</p>
  
  <blockquote>
    <p>Error in execution:    -- caused by:
    java.util.concurrent.ExecutionException: No response from file
    transfer initiator:</p>
  </blockquote>
  
  <p><strong>Error (<em>If file is sent via Adium</em>)</strong> :</p>
  
  <blockquote>
    <p>java.util.concurrent.ExecutionException: Could not establish socket
    with any provided host: item-not-found(404) Could not establish socket
    with any provided host</p>
  </blockquote>
  
  <p><strong>Error (<em>If file is sent via another instance of my app</em>)</strong> :</p>
  
  <blockquote>
    <p>Error in execution:    -- caused by:
    java.util.concurrent.ExecutionException:    -- caused by: No response
    from remote client:</p>
  </blockquote>
  
  <p><strong>My logs: (When attempting to receive file from Spark)</strong></p>
  
  <p>It appears that I am SENDING this error! (Not receiving it). Why would this be?</p>
  
  <pre><code>&gt; 05-01 12:49:36.013: I/System.out(1000): 12:49:35 PM SENT (1093411736):
  &gt; &lt;iq id="791-6222" to="beta.myCompany.co.uk"
  &gt; from="theUsername@beta.myCompany.co.uk/BAM-1918973529" type="error"&gt;&lt;error
  &gt; code="501" type="CANCEL"&gt;&lt;feature-not-implemented
  &gt; xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/&gt;&lt;/error&gt;&lt;/iq&gt;
  </code></pre>
  
  <p><strong>Extra Logs</strong> :</p>
  
  <pre><code>05-01 14:46:06.133: I/System.out(1370): 02:46:06 PM RCV  (1093401112): &lt;iq id="eRi5A-72" to="myUsername@beta.myCompany.co.uk/BAM-1755858011" from="friendsUsername@beta.myCompany.co.uk/Spark 2.6.3" type="set"&gt;&lt;si xmlns="http://jabber.org/protocol/si" id="jsi_5991130279184702850" profile="http://jabber.org/protocol/si/profile/file-transfer"&gt;&lt;file xmlns="http://jabber.org/protocol/si/profile/file-transfer" name="Test.rtf" size="318"&gt;&lt;desc&gt;Sending file&lt;/desc&gt;&lt;/file&gt;&lt;feature xmlns="http://jabber.org/protocol/feature-neg"&gt;&lt;x xmlns="jabber:x:data" type="form"&gt;&lt;field var="stream-method" type="list-single"&gt;&lt;option&gt;&lt;value&gt;http://jabber.org/protocol/bytestreams&lt;/value&gt;&lt;/option&gt;&lt;option&gt;&lt;value&gt;http://jabber.org/protocol/ibb&lt;/value&gt;&lt;/option&gt;&lt;/field&gt;&lt;/x&gt;&lt;/feature&gt;&lt;/si&gt;&lt;/iq&gt;
  05-01 14:46:08.283: I/System.out(1370): 02:46:08 PM SENT (1093401112): &lt;iq id="eRi5A-72" to="friendsUsername@beta.myCompany.co.uk/Spark 2.6.3" from="myUsername@beta.myCompany.co.uk/BAM-1755858011" type="result"&gt;&lt;si xmlns="http://jabber.org/protocol/si"&gt;&lt;feature xmlns="http://jabber.org/protocol/feature-neg"&gt;&lt;x xmlns="jabber:x:data" type="submit"&gt;&lt;field var="stream-method"&gt;&lt;value&gt;http://jabber.org/protocol/bytestreams&lt;/value&gt;&lt;/field&gt;&lt;/x&gt;&lt;/feature&gt;&lt;/si&gt;&lt;/iq&gt;
  05-01 14:46:08.312: I/System.out(1370): 02:46:08 PM RCV  (1093401112): &lt;iq id="eRi5A-73" to="myUsername@beta.myCompany.co.uk/BAM-1755858011" type="get" from="friendsUsername@beta.myCompany.co.uk/Spark 2.6.3"&gt;&lt;query xmlns="http://jabber.org/protocol/disco#info"/&gt;&lt;/iq&gt;
  05-01 14:46:14.352: W/System.err(1370): Error in execution: 
  05-01 14:46:14.352: W/System.err(1370):   -- caused by: java.util.concurrent.ExecutionException: No response from file transfer initiator:[
  [ERROR LOG IS HERE]
  05-01 14:46:14.732: I/System.out(1370): 02:46:14 PM SENT (1093401112): &lt;iq id="eRi5A-73" to="friendsUsername@beta.myCompany.co.uk/Spark 2.6.3" type="result"&gt;&lt;query xmlns="http://jabber.org/protocol/disco#info"&gt;&lt;identity category="client" name="Smack" type="pc"/&gt;&lt;feature var="http://jabber.org/protocol/caps"/&gt;&lt;feature var="http://jabber.org/protocol/bytestreams"/&gt;&lt;feature var="http://jabber.org/protocol/si/profile/file-transfer"/&gt;&lt;feature var="http://jabber.org/protocol/si"/&gt;&lt;feature var="http://jabber.org/protocol/ibb"/&gt;&lt;/query&gt;&lt;/iq&gt;
  05-01 14:46:14.773: I/System.out(1370): 02:46:14 PM RCV  (1093401112): &lt;iq id="eRi5A-77" to="myUsername@beta.myCompany.co.uk/BAM-1755858011" type="set" from="friendsUsername@beta.myCompany.co.uk/Spark 2.6.3"&gt;&lt;query xmlns="http://jabber.org/protocol/bytestreams" sid="jsi_5991130279184702850" mode="tcp"&gt;&lt;streamhost jid="friendsUsername@beta.myCompany.co.uk/Spark 2.6.3" host="10.95.104.25" port="7777"/&gt;&lt;streamhost jid="proxy.beta.myCompany.co.uk" host="127.0.1.1" port="7777"/&gt;&lt;/query&gt;&lt;/iq&gt;
  05-01 14:46:29.783: I/System.out(1370): 02:46:29 PM RCV  (1093401112): &lt;iq type="get" id="537-7113" from="beta.myCompany.co.uk" to="myUsername@beta.myCompany.co.uk/BAM-1755858011"&gt;&lt;ping xmlns="urn:xmpp:ping"/&gt;&lt;/iq&gt;
  05-01 14:46:29.843: I/System.out(1370): 02:46:29 PM SENT (1093401112): &lt;iq id="537-7113" to="beta.myCompany.co.uk" from="myUsername@beta.myCompany.co.uk/BAM-1755858011" type="error"&gt;&lt;error code="501" type="CANCEL"&gt;&lt;feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/&gt;&lt;/error&gt;&lt;/iq&gt;
  </code></pre>