--- /home/cmeng/sandbox/source/smack/smack_omemo/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java	2018-01-25 08:45:24.000000000 
+++ /home/cmeng/workspace/android/smack/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java	2018-01-29 17:13:27.000000000 
@@ -543,14 +543,19 @@
     private static OmemoBundleElement fetchBundle(XMPPConnection connection,
                                                   OmemoDevice contactsDevice)
             throws SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException,
             XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException,
             PubSubException.NotAPubSubNodeException
     {
+        LeafNode node = null;
         PubSubManager pm = PubSubManager.getInstance(connection, contactsDevice.getJid());
-        LeafNode node = pm.getLeafNode(contactsDevice.getBundleNodeName());
+        try {
+            node = pm.getLeafNode(contactsDevice.getBundleNodeName());
+        } catch (SmackException.NoResponseException e) {
+            LOGGER.log(Level.WARNING, "Ignore OmemoService fetchBundle response timeout: " + e.getMessage());
+        }
 
         if (node == null) {
             return null;
         }
 
         List<PayloadItem<OmemoBundleElement>> bundleItems = node.getItems();
@@ -571,14 +576,23 @@
      * @throws InterruptedException
      * @throws SmackException.NoResponseException
      */
     static void publishBundle(XMPPConnection connection, OmemoDevice userDevice, OmemoBundleElement bundle)
             throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
             SmackException.NoResponseException {
+        /*
+         * Patch to ignore OmemoService prekey publish response timeout due to high latency server or
+         * slow device, prekeys publish will still complete in background.
+         * Smack sometimes report response timeout even the reply stanza is received within timeout period.
+         */
         PubSubManager pm = PubSubManager.getInstance(connection, connection.getUser().asBareJid());
-        pm.tryToPublishAndPossibleAutoCreate(userDevice.getBundleNodeName(), new PayloadItem<>(bundle));
+        try {
+            pm.tryToPublishAndPossibleAutoCreate(userDevice.getBundleNodeName(), new PayloadItem<>(bundle));
+        } catch (SmackException.NoResponseException e) {
+            LOGGER.log(Level.WARNING, "Ignore OmemoService publishBundle response timeout: " + e.getMessage());
+        }
     }
 
     /**
      * Retrieve the OMEMO device list of a contact.
      *
      * @param connection authenticated XMPP connection.
@@ -593,15 +607,20 @@
      */
     private static OmemoDeviceListElement fetchDeviceList(XMPPConnection connection, BareJid contact)
             throws InterruptedException, PubSubException.NotALeafNodeException, SmackException.NoResponseException,
             SmackException.NotConnectedException, XMPPException.XMPPErrorException,
             PubSubException.NotAPubSubNodeException
     {
+        LeafNode node = null;
         PubSubManager pm = PubSubManager.getInstance(connection, contact);
         String nodeName = OmemoConstants.PEP_NODE_DEVICE_LIST;
-        LeafNode node = pm.getLeafNode(nodeName);
+        try {
+            node = pm.getLeafNode(nodeName);
+        } catch (SmackException.NoResponseException e) {
+            LOGGER.log(Level.WARNING, "Ignore OmemoService fetchDeviceList response timeout: " + e.getMessage());
+        }
 
         if (node == null) {
             return null;
         }
 
         List<PayloadItem<OmemoDeviceListElement>> items = node.getItems();
@@ -623,14 +642,18 @@
      * @throws PubSubException.NotALeafNodeException
      */
     static void publishDeviceList(XMPPConnection connection, OmemoDeviceListElement deviceList)
             throws InterruptedException, XMPPException.XMPPErrorException, SmackException.NotConnectedException,
             SmackException.NoResponseException
     {
-        PubSubManager.getInstance(connection, connection.getUser().asBareJid())
-                .tryToPublishAndPossibleAutoCreate(OmemoConstants.PEP_NODE_DEVICE_LIST, new PayloadItem<>(deviceList));
+        PubSubManager pm = PubSubManager.getInstance(connection, connection.getUser().asBareJid());
+        try {
+            pm.tryToPublishAndPossibleAutoCreate(OmemoConstants.PEP_NODE_DEVICE_LIST, new PayloadItem<>(deviceList));
+        } catch (SmackException.NoResponseException e) {
+            LOGGER.log(Level.WARNING, "Ignore OmemoService publishDeviceList response timeout: " + e.getMessage());
+        }
     }
 
     /**
      *
      * @param connection
      * @param userDevice
