Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'CL-8955' of https://github.com/pubnub/pubnub-api into C…

…L-8955
  • Loading branch information...
commit fc92d8b865d7aae2f0d5625b0638c5912ffbc345 2 parents dee9f16 + ee8c43b
Pandu Masabathula budgetpreneur authored

Showing 116 changed files with 2,568 additions and 1,443 deletions. Show diff stats Hide diff stats

  1. 0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/Andr.Unit.csproj
  2. 0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/Common.cs
  3. 0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/EncryptionTests.cs
  4. 0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/Properties/AndroidManifest.xml
  5. 0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/PubnubUnitTest.cs
  6. +51 20 mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/Resources/Resource.designer.cs
  7. 0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/WhenAClientIsPresented.cs
  8. 0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/WhenAMessageIsPublished.cs
  9. 0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/WhenDetailedHistoryIsRequested.cs
  10. 0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/WhenGetRequestServerTime.cs
  11. 0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/WhenSubscribedToAChannel.cs
  12. 0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/WhenUnsubscribedToAChannel.cs
  13. 0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Android.NUnitLite/Android.NUnitLite.csproj
  14. 0  mono-for-android/3.4/Pubnub-Messaging/MonoDroid.Dialog/MonoDroid.Dialog.csproj
  15. 0  mono-for-android/3.4/Pubnub-Messaging/Newtonsoft.Json/Newtonsoft.Json.MonoDroid.csproj
  16. 0  mono-for-android/3.4/Pubnub-Messaging/Newtonsoft.Json/Newtonsoft.Json.MonoTouch.csproj
  17. 0  mono-for-android/3.4/Pubnub-Messaging/Newtonsoft.Json/Newtonsoft.Json.MonoTouch.pidb
  18. 0  mono-for-android/3.4/Pubnub-Messaging/Newtonsoft.Json/Utilities/LinqBridge.cs
  19. 0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Assets/AboutAssets.txt
  20. 0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/LaunchScreen.cs
  21. 0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/MainActivity.cs
  22. 0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Properties/AndroidManifest.xml
  23. 0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Properties/AssemblyInfo.cs
  24. 0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/PubNubMessaging.csproj
  25. +259 73 mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Pubnub.cs
  26. 0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/AboutResources.txt
  27. +82 51 mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/Resource.designer.cs
  28. 0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/drawable/Icon.png
  29. 0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/layout-large/Launch.axml
  30. 0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/layout-large/Main.axml
  31. 0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/layout/Launch.axml
  32. 0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/layout/Main.axml
  33. 0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/layout/Proxy.axml
  34. 0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/values/Strings.xml
  35. 0  mono-for-android/3.4/Pubnub-Messaging/Pubnub-Messaging.sln
  36. +8 10 mono-for-android/3.4/Pubnub-Messaging/Pubnub-Messaging.userprefs
  37. +1 1  mono-for-linux/3.4/Pubnub-Messaging/PubNub-Console/AssemblyInfo.cs
  38. 0  mono-for-linux/3.4/Pubnub-Messaging/PubNub-Console/PubNub-Messaging.cs
  39. +7 6 mono-for-linux/3.4/Pubnub-Messaging/PubNub-Console/PubNub-Messaging.csproj
  40. BIN  mono-for-linux/3.4/Pubnub-Messaging/PubNub-Console/PubNub-Messaging.pidb
  41. +259 73 mono-for-linux/3.4/Pubnub-Messaging/PubNub-Console/Pubnub.cs
  42. +426 273 mono-for-linux/3.4/Pubnub-Messaging/PubNub-Console/PubnubExample.cs
  43. 0  mono-for-linux/3.4/Pubnub-Messaging/PubNub-Console/app.config
  44. 0  mono-for-linux/3.4/Pubnub-Messaging/PubNub-Messaging.sln
  45. +38 30 mono-for-linux/3.4/Pubnub-Messaging/PubNub-Messaging.userprefs
  46. +1 1  mono-for-linux/3.4/Pubnub-Messaging/PubNubTest/AssemblyInfo.cs
  47. +1 1  mono-for-linux/3.4/Pubnub-Messaging/PubNubTest/Common.cs
  48. +453 454 mono-for-linux/3.4/Pubnub-Messaging/PubNubTest/EncryptionTests.cs
  49. +12 12 mono-for-linux/3.4/Pubnub-Messaging/PubNubTest/PubNub-Messaging.Tests.csproj
  50. BIN  mono-for-linux/3.4/Pubnub-Messaging/PubNubTest/PubNub-Messaging.Tests.pidb
  51. +1 1  mono-for-linux/3.4/Pubnub-Messaging/PubNubTest/PubnubUnitTest.cs
  52. +1 1  mono-for-linux/3.4/Pubnub-Messaging/PubNubTest/WhenAClientIsPresented.cs
  53. +5 1 mono-for-linux/3.4/Pubnub-Messaging/PubNubTest/WhenAMessageIsPublished.cs
  54. 0  mono-for-linux/3.4/Pubnub-Messaging/PubNubTest/WhenDetailedHistoryIsRequested.cs
  55. 0  mono-for-linux/3.4/Pubnub-Messaging/PubNubTest/WhenGetRequestHistoryMessages.cs
  56. +0 1  mono-for-linux/3.4/Pubnub-Messaging/PubNubTest/WhenGetRequestServerTime.cs
  57. 0  mono-for-linux/3.4/Pubnub-Messaging/PubNubTest/WhenSubscribedToAChannel.cs
  58. 0  mono-for-linux/3.4/Pubnub-Messaging/PubNubTest/WhenUnsubscribedToAChannel.cs
  59. +2 3 mono-for-linux/3.4/Pubnub-Messaging/PubNubTest/app.config
  60. 0  mono-for-mac/3.4/PubNub-Messaging/PubNub-Console/AssemblyInfo.cs
  61. 0  mono-for-mac/3.4/PubNub-Messaging/PubNub-Console/PubNub-Messaging.cs
  62. 0  mono-for-mac/3.4/PubNub-Messaging/PubNub-Console/PubNub-Messaging.csproj
  63. +259 73 mono-for-mac/3.4/PubNub-Messaging/PubNub-Console/Pubnub.cs
  64. +426 273 mono-for-mac/3.4/PubNub-Messaging/PubNub-Console/PubnubExample.cs
  65. 0  mono-for-mac/3.4/PubNub-Messaging/PubNub-Console/app.config
  66. 0  mono-for-mac/3.4/PubNub-Messaging/PubNub-Messaging.sln
  67. +11 8 mono-for-mac/3.4/PubNub-Messaging/PubNub-Messaging.userprefs
  68. 0  mono-for-mac/3.4/PubNub-Messaging/PubNubTest/AssemblyInfo.cs
  69. 0  mono-for-mac/3.4/PubNub-Messaging/PubNubTest/Common.cs
  70. 0  mono-for-mac/3.4/PubNub-Messaging/PubNubTest/EncryptionTests.cs
  71. 0  mono-for-mac/3.4/PubNub-Messaging/PubNubTest/PubNub-Messaging.Tests.csproj
  72. 0  mono-for-mac/3.4/PubNub-Messaging/PubNubTest/PubnubUnitTest.cs
  73. +1 1  mono-for-mac/3.4/PubNub-Messaging/PubNubTest/WhenAClientIsPresented.cs
  74. 0  mono-for-mac/3.4/PubNub-Messaging/PubNubTest/WhenAMessageIsPublished.cs
  75. 0  mono-for-mac/3.4/PubNub-Messaging/PubNubTest/WhenDetailedHistoryIsRequested.cs
  76. 0  mono-for-mac/3.4/PubNub-Messaging/PubNubTest/WhenGetRequestHistoryMessages.cs
  77. 0  mono-for-mac/3.4/PubNub-Messaging/PubNubTest/WhenGetRequestServerTime.cs
  78. 0  mono-for-mac/3.4/PubNub-Messaging/PubNubTest/WhenSubscribedToAChannel.cs
  79. 0  mono-for-mac/3.4/PubNub-Messaging/PubNubTest/WhenUnsubscribedToAChannel.cs
  80. 0  mono-for-mac/3.4/PubNub-Messaging/PubNubTest/app.config
  81. 0  monotouch/3.4/Pubnub-Messaging/Newtonsoft.Json/Newtonsoft.Json.MonoDroid.csproj
  82. 0  monotouch/3.4/Pubnub-Messaging/Newtonsoft.Json/Newtonsoft.Json.MonoTouch.csproj
  83. 0  monotouch/3.4/Pubnub-Messaging/Newtonsoft.Json/Newtonsoft.Json.MonoTouch.pidb
  84. 0  monotouch/3.4/Pubnub-Messaging/Newtonsoft.Json/Utilities/LinqBridge.cs
  85. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging.Tests/AppDelegate.cs
  86. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging.Tests/Common.cs
  87. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging.Tests/EncryptionTests.cs
  88. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging.Tests/Info.plist
  89. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging.Tests/Main.cs
  90. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging.Tests/Pubnub-Messaging.Tests.csproj
  91. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging.Tests/PubnubUnitTest.cs
  92. +1 1  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging.Tests/WhenAClientIsPresented.cs
  93. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging.Tests/WhenAMessageIsPublished.cs
  94. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging.Tests/WhenDetailedHistoryIsRequested.cs
  95. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging.Tests/WhenGetRequestHistoryMessages.cs
  96. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging.Tests/WhenGetRequestServerTime.cs
  97. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging.Tests/WhenSubscribedToAChannel.cs
  98. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging.Tests/WhenUnsubscribedToAChannel.cs
  99. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging.sln
  100. +4 2 monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging.userprefs
  101. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging/AppDelegate.cs
  102. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging/DeviceHardware.cs
  103. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging/GraphHeader.cs
  104. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging/GraphHeaderView.cs
  105. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging/Info.plist
  106. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging/InputAlertView.cs
  107. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging/Main.cs
  108. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging/PerformanceHeader.cs
  109. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging/PerformanceHeaderView.cs
  110. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging/Pubnub-Messaging.csproj
  111. +259 73 monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging/Pubnub.cs
  112. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging/Pubnub_MessagingMain.cs
  113. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging/Pubnub_MessagingSpeedTest.cs
  114. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging/Pubnub_MessagingSub.cs
  115. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging/SdHeader.cs
  116. 0  monotouch/3.4/Pubnub-Messaging/Pubnub-Messaging/SdHeaderView.cs
0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/Andr.Unit.csproj 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/Common.cs 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/EncryptionTests.cs 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/Properties/AndroidManifest.xml 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/PubnubUnitTest.cs 100644 → 100755
File mode changed
71 mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/Resources/Resource.designer.cs
... ... @@ -1,3 +1,4 @@
  1 +#pragma warning disable 1591
1 2 // ------------------------------------------------------------------------------
2 3 // <autogenerated>
3 4 // This code was generated by a tool.
@@ -8,13 +9,25 @@
8 9 // </autogenerated>
9 10 // ------------------------------------------------------------------------------
10 11
  12 +[assembly: Android.Runtime.ResourceDesignerAttribute("Andr.Unit.Resource", IsApplication=true)]
  13 +
11 14 namespace Andr.Unit
12 15 {
13 16
14 17
  18 + [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
15 19 public partial class Resource
16 20 {
17 21
  22 + Resource()
  23 + {
  24 + global::Android.Runtime.ResourceIdManager.UpdateIdValues ();
  25 + }
  26 +
  27 + public static void UpdateIdValues()
  28 + {
  29 + }
  30 +
18 31 public partial class Attribute
19 32 {
20 33
@@ -29,6 +42,9 @@ public partial class Drawable
29 42 // aapt resource value: 0x7f020000
30 43 public const int Icon = 2130837504;
31 44
  45 + // aapt resource value: 0x7f020001
  46 + public const int monoandroidsplash = 2130837505;
  47 +
32 48 private Drawable()
33 49 {
34 50 }
@@ -37,35 +53,35 @@ private Drawable()
37 53 public partial class Id
38 54 {
39 55
40   - // aapt resource value: 0x7f050002
41   - public const int dialog_BoolField = 2131034114;
  56 + // aapt resource value: 0x7f060002
  57 + public const int dialog_BoolField = 2131099650;
42 58
43   - // aapt resource value: 0x7f050003
44   - public const int dialog_Button = 2131034115;
  59 + // aapt resource value: 0x7f060003
  60 + public const int dialog_Button = 2131099651;
45 61
46   - // aapt resource value: 0x7f050000
47   - public const int dialog_LabelField = 2131034112;
  62 + // aapt resource value: 0x7f060000
  63 + public const int dialog_LabelField = 2131099648;
48 64
49   - // aapt resource value: 0x7f050001
50   - public const int dialog_LabelSubtextField = 2131034113;
  65 + // aapt resource value: 0x7f060001
  66 + public const int dialog_LabelSubtextField = 2131099649;
51 67
52   - // aapt resource value: 0x7f050005
53   - public const int dialog_Panel = 2131034117;
  68 + // aapt resource value: 0x7f060005
  69 + public const int dialog_Panel = 2131099653;
54 70
55   - // aapt resource value: 0x7f050006
56   - public const int dialog_RadioButtonList = 2131034118;
  71 + // aapt resource value: 0x7f060006
  72 + public const int dialog_RadioButtonList = 2131099654;
57 73
58   - // aapt resource value: 0x7f050007
59   - public const int dialog_Spinner = 2131034119;
  74 + // aapt resource value: 0x7f060007
  75 + public const int dialog_Spinner = 2131099655;
60 76
61   - // aapt resource value: 0x7f050004
62   - public const int dialog_ValueField = 2131034116;
  77 + // aapt resource value: 0x7f060004
  78 + public const int dialog_ValueField = 2131099652;
63 79
64   - // aapt resource value: 0x7f050008
65   - public const int iFormFieldValue = 2131034120;
  80 + // aapt resource value: 0x7f060008
  81 + public const int iFormFieldValue = 2131099656;
66 82
67   - // aapt resource value: 0x7f050009
68   - public const int myButton = 2131034121;
  83 + // aapt resource value: 0x7f060009
  84 + public const int myButton = 2131099657;
69 85
70 86 private Id()
71 87 {
@@ -129,6 +145,9 @@ public partial class Layout
129 145 // aapt resource value: 0x7f030011
130 146 public const int Main = 2130903057;
131 147
  148 + // aapt resource value: 0x7f030012
  149 + public const int monoandroidsplash = 2130903058;
  150 +
132 151 private Layout()
133 152 {
134 153 }
@@ -147,5 +166,17 @@ private String()
147 166 {
148 167 }
149 168 }
  169 +
  170 + public partial class Style
  171 + {
  172 +
  173 + // aapt resource value: 0x7f050000
  174 + public const int Mono_Android_Theme_Splash = 2131034112;
  175 +
  176 + private Style()
  177 + {
  178 + }
  179 + }
150 180 }
151 181 }
  182 +#pragma warning restore 1591
0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/WhenAClientIsPresented.cs 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/WhenAMessageIsPublished.cs 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/WhenDetailedHistoryIsRequested.cs 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/WhenGetRequestServerTime.cs 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/WhenSubscribedToAChannel.cs 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Andr.Unit/WhenUnsubscribedToAChannel.cs 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/Andr.Unit-master/Android.NUnitLite/Android.NUnitLite.csproj 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/MonoDroid.Dialog/MonoDroid.Dialog.csproj 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/Newtonsoft.Json/Newtonsoft.Json.MonoDroid.csproj 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/Newtonsoft.Json/Newtonsoft.Json.MonoTouch.csproj 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/Newtonsoft.Json/Newtonsoft.Json.MonoTouch.pidb 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/Newtonsoft.Json/Utilities/LinqBridge.cs 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Assets/AboutAssets.txt 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/LaunchScreen.cs 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/MainActivity.cs 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Properties/AndroidManifest.xml 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Properties/AssemblyInfo.cs 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/PubNubMessaging.csproj 100644 → 100755
File mode changed
332 mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Pubnub.cs 100644 → 100755
... ... @@ -1,5 +1,4 @@
1   -//Build Date: March 07, 2013
2   -
  1 +//Build Date: March 16, 2013
3 2 #if (__MonoCS__)
4 3 #define TRACE
5 4 #endif
@@ -38,17 +37,18 @@
38 37 using System.Security.Cryptography.X509Certificates;
39 38 #endif
40 39
  40 +
41 41 namespace PubNubMessaging.Core
42 42 {
43 43 // INotifyPropertyChanged provides a standard event for objects to notify clients that one of its properties has changed
44 44 public class Pubnub : INotifyPropertyChanged
45 45 {
46   - const int pubnubWebRequestCallbackIntervalInSeconds = 310;
47   - const int pubnubOperationTimeoutIntervalInSeconds = 15;
48   - const int pubnubNetworkTcpCheckIntervalInSeconds = 15;
49   - const int pubnubNetworkCheckRetries = 50;
50   - const int pubnubWebRequestRetryIntervalInSeconds = 10;
51   - bool enableResumeOnReconnect = true;
  46 + int _pubnubWebRequestCallbackIntervalInSeconds = 310;
  47 + int _pubnubOperationTimeoutIntervalInSeconds = 15;
  48 + int _pubnubNetworkTcpCheckIntervalInSeconds = 15;
  49 + int _pubnubNetworkCheckRetries = 50;
  50 + int _pubnubWebRequestRetryIntervalInSeconds = 10;
  51 + bool _enableResumeOnReconnect = true;
52 52 bool overrideTcpKeepAlive = true;
53 53 const LoggingMethod.Level pubnubLogLevel = LoggingMethod.Level.Error;
54 54
@@ -76,6 +76,83 @@ public void RaisePropertyChanged(string propertyName)
76 76 ConcurrentDictionary<string, Timer> _channelReconnectTimer = new ConcurrentDictionary<string, Timer>();
77 77 ConcurrentDictionary<Uri, Timer> _channelHeartbeatTimer = new ConcurrentDictionary<Uri, Timer>();
78 78
  79 + internal int SubscribeTimeout
  80 + {
  81 + get
  82 + {
  83 + return _pubnubWebRequestCallbackIntervalInSeconds;
  84 + }
  85 +
  86 + set
  87 + {
  88 + _pubnubWebRequestCallbackIntervalInSeconds = value;
  89 + }
  90 + }
  91 +
  92 + internal int NonSubscribeTimeout
  93 + {
  94 + get
  95 + {
  96 + return _pubnubOperationTimeoutIntervalInSeconds;
  97 + }
  98 +
  99 + set
  100 + {
  101 + _pubnubOperationTimeoutIntervalInSeconds = value;
  102 + }
  103 + }
  104 +
  105 + internal int NetworkCheckMaxRetries
  106 + {
  107 + get
  108 + {
  109 + return _pubnubNetworkCheckRetries;
  110 + }
  111 +
  112 + set
  113 + {
  114 + _pubnubNetworkCheckRetries = value;
  115 + }
  116 + }
  117 +
  118 + internal int NetworkCheckRetryInterval
  119 + {
  120 + get
  121 + {
  122 + return _pubnubWebRequestRetryIntervalInSeconds;
  123 + }
  124 +
  125 + set
  126 + {
  127 + _pubnubWebRequestRetryIntervalInSeconds = value;
  128 + }
  129 + }
  130 +
  131 + internal int HeartbeatInterval
  132 + {
  133 + get
  134 + {
  135 + return _pubnubNetworkTcpCheckIntervalInSeconds;
  136 + }
  137 +
  138 + set
  139 + {
  140 + _pubnubNetworkTcpCheckIntervalInSeconds = value;
  141 + }
  142 + }
  143 +
  144 + internal bool EnableResumeOnReconnect
  145 + {
  146 + get
  147 + {
  148 + return _enableResumeOnReconnect;
  149 + }
  150 + set
  151 + {
  152 + _enableResumeOnReconnect = value;
  153 + }
  154 + }
  155 +
79 156 private IPubnubUnitTest _pubnubUnitTest;
80 157 public IPubnubUnitTest PubnubUnitTest
81 158 {
@@ -197,7 +274,7 @@ private void Init(string publishKey, string subscribeKey, string secretKey, stri
197 274
198 275 private void ReconnectNetwork<T>(ReconnectState<T> netState)
199 276 {
200   - System.Threading.Timer timer = new Timer(new TimerCallback(ReconnectNetworkCallback<T>), netState, 0, pubnubNetworkTcpCheckIntervalInSeconds * 1000);
  277 + System.Threading.Timer timer = new Timer(new TimerCallback(ReconnectNetworkCallback<T>), netState, 0, _pubnubNetworkTcpCheckIntervalInSeconds * 1000);
201 278 _channelReconnectTimer.AddOrUpdate(string.Join(",",netState.Channels), timer, (key, oldState) => timer);
202 279 }
203 280
@@ -222,7 +299,7 @@ void ReconnectNetworkCallback<T>(Object reconnectState)
222 299 else
223 300 {
224 301 _channelInternetRetry.AddOrUpdate(channel, 1, (key, oldValue) => oldValue + 1);
225   - LoggingMethod.WriteToLog(string.Format("DateTime {0}, {1} {2} reconnectNetworkCallback. Retry {3} of {4}", DateTime.Now.ToString(), channel, netState.Type, _channelInternetRetry[channel], pubnubNetworkCheckRetries), LoggingMethod.LevelInfo);
  302 + LoggingMethod.WriteToLog(string.Format("DateTime {0}, {1} {2} reconnectNetworkCallback. Retry {3} of {4}", DateTime.Now.ToString(), channel, netState.Type, _channelInternetRetry[channel], _pubnubNetworkCheckRetries), LoggingMethod.LevelInfo);
226 303 }
227 304 }
228 305
@@ -245,7 +322,7 @@ void ReconnectNetworkCallback<T>(Object reconnectState)
245 322 break;
246 323 }
247 324 }
248   - else if (_channelInternetRetry[channel] >= pubnubNetworkCheckRetries)
  325 + else if (_channelInternetRetry[channel] >= _pubnubNetworkCheckRetries)
249 326 {
250 327 if (_channelReconnectTimer.ContainsKey(channel))
251 328 {
@@ -316,8 +393,8 @@ void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
316 393 if (overrideTcpKeepAlive)
317 394 {
318 395 heartBeatTimer.Change(
319   - (-1 == pubnubNetworkTcpCheckIntervalInSeconds) ? -1 : pubnubNetworkTcpCheckIntervalInSeconds * 1000,
320   - (-1 == pubnubNetworkTcpCheckIntervalInSeconds) ? -1 : pubnubNetworkTcpCheckIntervalInSeconds * 1000);
  396 + (-1 == _pubnubNetworkTcpCheckIntervalInSeconds) ? -1 : _pubnubNetworkTcpCheckIntervalInSeconds * 1000,
  397 + (-1 == _pubnubNetworkTcpCheckIntervalInSeconds) ? -1 : _pubnubNetworkTcpCheckIntervalInSeconds * 1000);
321 398 }
322 399
323 400 LoggingMethod.WriteToLog(string.Format("DateTime {0}, System entered into Resume/Awake Mode.", DateTime.Now.ToString()), LoggingMethod.LevelInfo);
@@ -1076,7 +1153,7 @@ private void MultiChannelSubscribeRequest<T>(ResponseType type, string[] channel
1076 1153
1077 1154 if (_channelInternetStatus.ContainsKey(multiChannel) && (!_channelInternetStatus[multiChannel]) && _pubnetSystemActive)
1078 1155 {
1079   - if (_channelInternetRetry.ContainsKey(multiChannel) && (_channelInternetRetry[multiChannel] >= pubnubNetworkCheckRetries))
  1156 + if (_channelInternetRetry.ContainsKey(multiChannel) && (_channelInternetRetry[multiChannel] >= _pubnubNetworkCheckRetries))
1080 1157 {
1081 1158 LoggingMethod.WriteToLog(string.Format("DateTime {0}, Subscribe channel={1} - No internet connection. MAXed retries for internet ", DateTime.Now.ToString(), multiChannel), LoggingMethod.LevelInfo);
1082 1159 MultiplexExceptionHandler<T>(type,channels, userCallback, connectCallback, true, false);
@@ -1121,7 +1198,6 @@ private void MultiChannelSubscribeRequest<T>(ResponseType type, string[] channel
1121 1198 lastTimetoken = lastSubscribeTimetoken;
1122 1199 }
1123 1200 }
1124   -
1125 1201 LoggingMethod.WriteToLog(string.Format("DateTime {0}, Building request for channel(s)={1} with timetoken={2}", DateTime.Now.ToString(), string.Join(",",channels),lastTimetoken), LoggingMethod.LevelInfo);
1126 1202 // Build URL
1127 1203 Uri requestUrl = BuildMultiChannelSubscribeRequest(channels, (Convert.ToInt64(timetoken.ToString()) == 0) ? Convert.ToInt64(timetoken.ToString()) : lastTimetoken);
@@ -1362,13 +1438,13 @@ private bool UrlProcessRequest<T>(Uri requestUri, RequestState<T> pubnubRequestS
1362 1438 //Eventhough heart-beat is disabled, run one time to check internet connection by setting dueTime=0
1363 1439 heartBeatTimer = new System.Threading.Timer(
1364 1440 new TimerCallback(OnPubnubHeartBeatTimeoutCallback<T>), pubnubRequestState, 0,
1365   - (-1 == pubnubNetworkTcpCheckIntervalInSeconds) ? Timeout.Infinite : pubnubNetworkTcpCheckIntervalInSeconds * 1000);
  1441 + (-1 == _pubnubNetworkTcpCheckIntervalInSeconds) ? Timeout.Infinite : _pubnubNetworkTcpCheckIntervalInSeconds * 1000);
1366 1442 _channelHeartbeatTimer.AddOrUpdate(requestUri, heartBeatTimer, (key, oldState) => heartBeatTimer);
1367 1443 }
1368 1444 else
1369 1445 {
1370 1446 #if ((!__MonoCS__) && (!SILVERLIGHT) && !WINDOWS_PHONE)
1371   - request.ServicePoint.SetTcpKeepAlive(true, pubnubNetworkTcpCheckIntervalInSeconds * 1000, 1000);
  1447 + request.ServicePoint.SetTcpKeepAlive(true, _pubnubNetworkTcpCheckIntervalInSeconds * 1000, 1000);
1372 1448 #endif
1373 1449 }
1374 1450 LoggingMethod.WriteToLog(string.Format("DateTime {0}, Request={1}", DateTime.Now.ToString(), requestUri.ToString()), LoggingMethod.LevelInfo);
@@ -1570,7 +1646,8 @@ void ConnectToHostAndSendRequest<T>(bool sslEnabled, TcpClient tcpClient, Reques
1570 1646 throw new Exception("SSL error");
1571 1647 }
1572 1648 }
1573   -#endif
  1649 +#endif
  1650 +
1574 1651 private void ConnectToHostAndSendRequestCallback<T>(IAsyncResult asynchronousResult)
1575 1652 {
1576 1653 StateObject<T> asynchStateObject = asynchronousResult.AsyncState as StateObject<T>;
@@ -1694,7 +1771,6 @@ private void SendRequestUsingTcpClient<T>(Uri requestUri, RequestState<T> pubnub
1694 1771 {
1695 1772 TcpClient tcpClient = new TcpClient();
1696 1773 tcpClient.NoDelay = false;
1697   -
1698 1774 #if(!MONODROID)
1699 1775 tcpClient.SendTimeout = pubnubRequestState.Request.Timeout;
1700 1776 #endif
@@ -1870,11 +1946,11 @@ void ProcessResponseCallbackWebExceptionHandler<T>(WebException webEx, RequestSt
1870 1946 else
1871 1947 {
1872 1948 _channelInternetRetry.AddOrUpdate(channel, 1, (key, oldValue) => oldValue + 1);
1873   - LoggingMethod.WriteToLog(string.Format("DateTime {0} {1} channel = {2} _urlRequest - Internet connection retry {3} of {4}", DateTime.Now.ToString(), asynchRequestState.Type, string.Join(",", asynchRequestState.Channels), _channelInternetRetry[channel], pubnubNetworkCheckRetries), LoggingMethod.LevelInfo);
  1949 + LoggingMethod.WriteToLog(string.Format("DateTime {0} {1} channel = {2} _urlRequest - Internet connection retry {3} of {4}", DateTime.Now.ToString(), asynchRequestState.Type, string.Join(",", asynchRequestState.Channels), _channelInternetRetry[channel], _pubnubNetworkCheckRetries), LoggingMethod.LevelInfo);
1874 1950 }
1875 1951 _channelInternetStatus[channel] = false;
1876 1952
1877   - Thread.Sleep(pubnubWebRequestRetryIntervalInSeconds * 1000);
  1953 + Thread.Sleep(_pubnubWebRequestRetryIntervalInSeconds * 1000);
1878 1954 }
1879 1955 }
1880 1956 #endif
@@ -1984,11 +2060,11 @@ private int GetTimeoutInSecondsForResponseType(ResponseType type)
1984 2060 int timeout;
1985 2061 if (type == ResponseType.Subscribe || type == ResponseType.Presence)
1986 2062 {
1987   - timeout = pubnubWebRequestCallbackIntervalInSeconds;
  2063 + timeout = _pubnubWebRequestCallbackIntervalInSeconds;
1988 2064 }
1989 2065 else
1990 2066 {
1991   - timeout = pubnubOperationTimeoutIntervalInSeconds;
  2067 + timeout = _pubnubOperationTimeoutIntervalInSeconds;
1992 2068 }
1993 2069 return timeout;
1994 2070 }
@@ -2010,8 +2086,8 @@ private void TerminateHeartbeatTimer(Uri requestUri)
2010 2086 try
2011 2087 {
2012 2088 requestHeatbeatTimer.Change(
2013   - (-1 == pubnubNetworkTcpCheckIntervalInSeconds) ? -1 : pubnubNetworkTcpCheckIntervalInSeconds * 1000,
2014   - (-1 == pubnubNetworkTcpCheckIntervalInSeconds) ? -1 : pubnubNetworkTcpCheckIntervalInSeconds * 1000);
  2089 + (-1 == _pubnubNetworkTcpCheckIntervalInSeconds) ? -1 : _pubnubNetworkTcpCheckIntervalInSeconds * 1000,
  2090 + (-1 == _pubnubNetworkTcpCheckIntervalInSeconds) ? -1 : _pubnubNetworkTcpCheckIntervalInSeconds * 1000);
2015 2091 requestHeatbeatTimer.Dispose();
2016 2092 }
2017 2093 catch (ObjectDisposedException ex)
@@ -2066,8 +2142,8 @@ private void TerminateReconnectTimer(string channelName)
2066 2142 {
2067 2143 Timer channelReconnectTimer = _channelReconnectTimer[channelName];
2068 2144 channelReconnectTimer.Change(
2069   - (-1 == pubnubNetworkTcpCheckIntervalInSeconds) ? -1 : pubnubNetworkTcpCheckIntervalInSeconds * 1000,
2070   - (-1 == pubnubNetworkTcpCheckIntervalInSeconds) ? -1 : pubnubNetworkTcpCheckIntervalInSeconds * 1000);
  2145 + (-1 == _pubnubNetworkTcpCheckIntervalInSeconds) ? -1 : _pubnubNetworkTcpCheckIntervalInSeconds * 1000,
  2146 + (-1 == _pubnubNetworkTcpCheckIntervalInSeconds) ? -1 : _pubnubNetworkTcpCheckIntervalInSeconds * 1000);
2071 2147 channelReconnectTimer.Dispose();
2072 2148 Timer removedTimer = null;
2073 2149 bool removed = _channelReconnectTimer.TryRemove(channelName, out removedTimer);
@@ -2109,22 +2185,28 @@ private void ResponseToConnectCallback<T>(List<object> result, ResponseType type
2109 2185 select channel.Key;
2110 2186 foreach (string channel in newChannels)
2111 2187 {
2112   - if (!IsPresenceChannel(channel))
  2188 + string jsonString = "";
  2189 + List<object> connectResult = new List<object>();
  2190 + //if (!IsPresenceChannel(channel))
  2191 + //{
  2192 + switch (type)
2113 2193 {
2114   - switch (type)
2115   - {
2116   - case ResponseType.Subscribe:
2117   - string jsonString = "";
2118   - List<object> connectResult = new List<object>();
2119   - jsonString = string.Format("[1, \"Connected\"]");
2120   - connectResult = (List<object>)JsonConvert.DeserializeObject<List<object>>(jsonString);
2121   - connectResult.Add(channel);
2122   - GoToCallback<T>(connectResult, connectCallback);
2123   - break;
2124   - default:
2125   - break;
2126   - }
  2194 + case ResponseType.Subscribe:
  2195 + jsonString = string.Format("[1, \"Connected\"]");
  2196 + connectResult = (List<object>)JsonConvert.DeserializeObject<List<object>>(jsonString);
  2197 + connectResult.Add(channel);
  2198 + GoToCallback<T>(connectResult, connectCallback);
  2199 + break;
  2200 + case ResponseType.Presence:
  2201 + jsonString = string.Format("[1, \"Presence Connected\"]");
  2202 + connectResult = (List<object>)JsonConvert.DeserializeObject<List<object>>(jsonString);
  2203 + connectResult.Add(channel.Replace("-pnpres", ""));
  2204 + GoToCallback<T>(connectResult, connectCallback);
  2205 + break;
  2206 + default:
  2207 + break;
2127 2208 }
  2209 + //}
2128 2210 }
2129 2211 }
2130 2212
@@ -2452,18 +2534,38 @@ private void MultiplexExceptionHandler<T>(ResponseType type, string[] channels,
2452 2534 string[] activeChannels = _multiChannelSubscribe.Keys.ToArray<string>();
2453 2535 MultiChannelUnSubscribeInit<T>(ResponseType.Unsubscribe, string.Join(",", activeChannels), null, null, null);
2454 2536
2455   - List<object> errorResult = new List<object>();
2456   - string jsonString = string.Format("[0, \"Unsubscribed after {0} failed retries\"]", pubnubNetworkCheckRetries);
2457   - errorResult = (List<object>)JsonConvert.DeserializeObject<List<object>>(jsonString);
2458   - string activeMultiChannel = string.Join(",", activeChannels).Replace("-pnpres", "");
2459   - errorResult.Add(activeMultiChannel.Split(','));
2460   -
2461   - LoggingMethod.WriteToLog(string.Format("DateTime {0}, Subscribe JSON network error response={1}", DateTime.Now.ToString(), jsonString), LoggingMethod.LevelInfo);
  2537 + string[] subscribeChannels = activeChannels.Where(filterChannel => !filterChannel.Contains("-pnpres")).ToArray();
  2538 + string[] presenceChannels = activeChannels.Where(filterChannel => filterChannel.Contains("-pnpres")).ToArray();
2462 2539
2463   - if (userCallback != null)
  2540 + if (subscribeChannels != null && subscribeChannels.Length > 0)
2464 2541 {
2465   - GoToCallback<T>(errorResult, userCallback);
  2542 + List<object> errorResult = new List<object>();
  2543 + string jsonString = string.Format("[0, \"Unsubscribed after {0} failed retries\"]", _pubnubNetworkCheckRetries);
  2544 + errorResult = (List<object>)JsonConvert.DeserializeObject<List<object>>(jsonString);
  2545 + string activeMultiChannel = string.Join(",", subscribeChannels);
  2546 + errorResult.Add(activeMultiChannel.Split(','));
  2547 +
  2548 + if (userCallback != null)
  2549 + {
  2550 + GoToCallback<T>(errorResult, userCallback);
  2551 + }
  2552 + LoggingMethod.WriteToLog(string.Format("DateTime {0}, Subscribe JSON network error response={1}", DateTime.Now.ToString(), jsonString), LoggingMethod.LevelInfo);
2466 2553 }
  2554 + if (presenceChannels != null && presenceChannels.Length > 0)
  2555 + {
  2556 + List<object> errorResult = new List<object>();
  2557 + string jsonString = string.Format("[0, \"Presence Unsubscribed after {0} failed retries\"]", _pubnubNetworkCheckRetries);
  2558 + errorResult = (List<object>)JsonConvert.DeserializeObject<List<object>>(jsonString);
  2559 + string activeMultiChannel = string.Join(",", presenceChannels).Replace("-pnpres", "");
  2560 + errorResult.Add(activeMultiChannel.Split(','));
  2561 +
  2562 + if (userCallback != null)
  2563 + {
  2564 + GoToCallback<T>(errorResult, userCallback);
  2565 + }
  2566 + LoggingMethod.WriteToLog(string.Format("DateTime {0}, Presence-Subscribe JSON network error response={1}", DateTime.Now.ToString(), jsonString), LoggingMethod.LevelInfo);
  2567 + }
  2568 +
2467 2569 }
2468 2570 else
2469 2571 {
@@ -2579,19 +2681,21 @@ private List<object> WrapResultBasedOnResponseType(ResponseType type, string jso
2579 2681 case ResponseType.Subscribe:
2580 2682 case ResponseType.Presence:
2581 2683 result.Add(string.Join(",",channels));
  2684 + long receivedTimetoken = Convert.ToInt64(result[1].ToString());
2582 2685 long minimumTimetoken = (_multiChannelSubscribe.Count > 0) ? _multiChannelSubscribe.Min(token => token.Value) : 0;
2583 2686 long maximumTimetoken = (_multiChannelSubscribe.Count > 0) ? _multiChannelSubscribe.Max(token => token.Value) : 0;
  2687 +
2584 2688 if (minimumTimetoken == 0 || lastTimetoken == 0)
2585 2689 {
2586 2690 if (maximumTimetoken == 0)
2587 2691 {
2588   - lastSubscribeTimetoken = Convert.ToInt64(result[1].ToString());
  2692 + lastSubscribeTimetoken = receivedTimetoken;
2589 2693 }
2590 2694 else
2591 2695 {
2592   - if (!enableResumeOnReconnect)
  2696 + if (!_enableResumeOnReconnect)
2593 2697 {
2594   - lastSubscribeTimetoken = Convert.ToInt64(result[1].ToString());
  2698 + lastSubscribeTimetoken = receivedTimetoken;
2595 2699 }
2596 2700 else
2597 2701 {
@@ -2601,7 +2705,21 @@ private List<object> WrapResultBasedOnResponseType(ResponseType type, string jso
2601 2705 }
2602 2706 else
2603 2707 {
2604   - lastSubscribeTimetoken = Convert.ToInt64(result[1].ToString());
  2708 + if (reconnect)
  2709 + {
  2710 + if (_enableResumeOnReconnect)
  2711 + {
  2712 + //do nothing. keep last subscribe token
  2713 + }
  2714 + else
  2715 + {
  2716 + lastSubscribeTimetoken = receivedTimetoken;
  2717 + }
  2718 + }
  2719 + else
  2720 + {
  2721 + lastSubscribeTimetoken = receivedTimetoken;
  2722 + }
2605 2723 }
2606 2724 break;
2607 2725 case ResponseType.Leave:
@@ -2771,6 +2889,44 @@ public void EndPendingRequests()
2771 2889 TerminateReconnectTimer();
2772 2890 }
2773 2891
  2892 + public void TerminateCurrentSubscriberRequest()
  2893 + {
  2894 + string[] channels = GetCurrentSubscriberChannels();
  2895 + if (channels != null)
  2896 + {
  2897 + string multiChannel = string.Join(",", channels);
  2898 + PubnubWebRequest request = (_channelRequest.ContainsKey(multiChannel)) ? _channelRequest[multiChannel] : null;
  2899 + if (request != null)
  2900 + {
  2901 + request.Abort();
  2902 +
  2903 + //TerminateHeartbeatTimer(request.RequestUri);
  2904 +
  2905 + //TerminateReconnectTimer(multiChannel);
  2906 +
  2907 + LoggingMethod.WriteToLog(string.Format("DateTime {0} TerminateCurrentSubsciberRequest {1}", DateTime.Now.ToString(), request.RequestUri.ToString()), LoggingMethod.LevelInfo);
  2908 + }
  2909 + }
  2910 + }
  2911 +
  2912 + /// <summary>
  2913 + /// FOR TESTING ONLY - To Enable Simulation of Network Non-Availability
  2914 + /// </summary>
  2915 + public void EnableSimulateNetworkFailForTestingOnly()
  2916 + {
  2917 + ClientNetworkStatus.SimulateNetworkFailForTesting = true;
  2918 + PubnubWebRequest.SimulateNetworkFailForTesting = true;
  2919 + }
  2920 +
  2921 + /// <summary>
  2922 + /// FOR TESTING ONLY - To Disable Simulation of Network Non-Availability
  2923 + /// </summary>
  2924 + public void DisableSimulateNetworkFailForTestingOnly()
  2925 + {
  2926 + ClientNetworkStatus.SimulateNetworkFailForTesting = false;
  2927 + PubnubWebRequest.SimulateNetworkFailForTesting = false;
  2928 + }
  2929 +
2774 2930 private bool IsPresenceChannel(string channel)
2775 2931 {
2776 2932 if (channel.LastIndexOf("-pnpres") > 0)
@@ -2782,6 +2938,17 @@ private bool IsPresenceChannel(string channel)
2782 2938 return false;
2783 2939 }
2784 2940 }
  2941 +
  2942 + private string[] GetCurrentSubscriberChannels()
  2943 + {
  2944 + string[] channels = null;
  2945 + if (_multiChannelSubscribe != null && _multiChannelSubscribe.Keys.Count > 0)
  2946 + {
  2947 + channels = _multiChannelSubscribe.Keys.ToArray<string>();
  2948 + }
  2949 +
  2950 + return channels;
  2951 + }
2785 2952 }
2786 2953
2787 2954 /// <summary>
@@ -3580,6 +3747,7 @@ public InternetState()
3580 3747 internal class ClientNetworkStatus
3581 3748 {
3582 3749 private static bool _status = true;
  3750 + private static bool _failClientNetworkForTesting = false;
3583 3751
3584 3752 #if (SILVERLIGHT || WINDOWS_PHONE)
3585 3753 private static ManualResetEvent mres = new ManualResetEvent(false);
@@ -3587,32 +3755,32 @@ internal class ClientNetworkStatus
3587 3755 #else
3588 3756 private static ManualResetEventSlim mres = new ManualResetEventSlim(false);
3589 3757 #endif
3590   - internal static void CheckInternetStatus(bool systemActive, Action<bool> Callback)
  3758 + internal static bool SimulateNetworkFailForTesting
3591 3759 {
3592   - if (Callback != null)
  3760 + get
3593 3761 {
3594   - try
3595   - {
3596   - if (systemActive)
3597   - {
3598   - CheckClientNetworkAvailability(Callback);
3599   - }
3600   - else
3601   - {
3602   - Callback(false);
3603   - }
3604   - }
3605   - catch (Exception ex)
3606   - {
3607   - LoggingMethod.WriteToLog(string.Format("DateTime {0} checkInternetStatus Error. {1}", DateTime.Now.ToString(), ex.ToString()), LoggingMethod.LevelVerbose);
3608   - }
  3762 + return _failClientNetworkForTesting;
3609 3763 }
  3764 +
  3765 + set
  3766 + {
  3767 + _failClientNetworkForTesting = value;
  3768 + }
  3769 +
3610 3770 }
3611 3771
3612 3772 internal static bool CheckInternetStatus(bool systemActive)
3613 3773 {
3614   - CheckClientNetworkAvailability(CallbackClientNetworkStatus);
3615   - return _status;
  3774 + if (_failClientNetworkForTesting)
  3775 + {
  3776 + //Only to simulate network fail
  3777 + return false;
  3778 + }
  3779 + else
  3780 + {
  3781 + CheckClientNetworkAvailability(CallbackClientNetworkStatus);
  3782 + return _status;
  3783 + }
3616 3784 }
3617 3785
3618 3786
@@ -3810,9 +3978,22 @@ public WebRequest Create(Uri uri)
3810 3978 internal class PubnubWebRequest : WebRequest
3811 3979 {
3812 3980 private IPubnubUnitTest pubnubUnitTest = null;
  3981 + private static bool simulateNetworkFailForTesting = false;
3813 3982
3814 3983 HttpWebRequest request;
3815 3984
  3985 + internal static bool SimulateNetworkFailForTesting
  3986 + {
  3987 + get
  3988 + {
  3989 + return simulateNetworkFailForTesting;
  3990 + }
  3991 + set
  3992 + {
  3993 + simulateNetworkFailForTesting = value;
  3994 + }
  3995 + }
  3996 +
3816 3997 #if (!SILVERLIGHT && !WINDOWS_PHONE)
3817 3998 private int _timeout;
3818 3999 public override int Timeout
@@ -3961,6 +4142,11 @@ public override WebResponse EndGetResponse(IAsyncResult asyncResult)
3961 4142 string stubResponse = pubnubUnitTest.GetStubResponse(request.RequestUri);
3962 4143 return new PubnubWebResponse(new MemoryStream(Encoding.UTF8.GetBytes(stubResponse)));
3963 4144 }
  4145 + else if (simulateNetworkFailForTesting)
  4146 + {
  4147 + WebException simulateException = new WebException("For simulating network fail, the remote name could not be resolved", WebExceptionStatus.ConnectFailure);
  4148 + throw simulateException;
  4149 + }
3964 4150 else
3965 4151 {
3966 4152 return new PubnubWebResponse(request.EndGetResponse(asyncResult));
0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/AboutResources.txt 100644 → 100755
File mode changed
133 mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/Resource.designer.cs 100644 → 100755
... ... @@ -1,3 +1,4 @@
  1 +#pragma warning disable 1591
1 2 // ------------------------------------------------------------------------------
2 3 // <autogenerated>
3 4 // This code was generated by a tool.
@@ -8,13 +9,25 @@
8 9 // </autogenerated>
9 10 // ------------------------------------------------------------------------------
10 11
  12 +[assembly: Android.Runtime.ResourceDesignerAttribute("PubNubMessaging.Core.Resource", IsApplication=true)]
  13 +
11 14 namespace PubNubMessaging.Core
12 15 {
13 16
14 17
  18 + [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
15 19 public partial class Resource
16 20 {
17 21
  22 + Resource()
  23 + {
  24 + global::Android.Runtime.ResourceIdManager.UpdateIdValues ();
  25 + }
  26 +
  27 + public static void UpdateIdValues()
  28 + {
  29 + }
  30 +
18 31 public partial class Attribute
19 32 {
20 33
@@ -29,6 +42,9 @@ public partial class Drawable
29 42 // aapt resource value: 0x7f020000
30 43 public const int Icon = 2130837504;
31 44
  45 + // aapt resource value: 0x7f020001
  46 + public const int monoandroidsplash = 2130837505;
  47 +
32 48 private Drawable()
33 49 {
34 50 }
@@ -37,80 +53,80 @@ private Drawable()
37 53 public partial class Id
38 54 {
39 55
40   - // aapt resource value: 0x7f050007
41   - public const int btnCancel = 2131034119;
  56 + // aapt resource value: 0x7f060007
  57 + public const int btnCancel = 2131099655;
42 58
43   - // aapt resource value: 0x7f05000b
44   - public const int btnDetailedHis = 2131034123;
  59 + // aapt resource value: 0x7f06000b
  60 + public const int btnDetailedHis = 2131099659;
45 61
46   - // aapt resource value: 0x7f05000c
47   - public const int btnHereNow = 2131034124;
  62 + // aapt resource value: 0x7f06000c
  63 + public const int btnHereNow = 2131099660;
48 64
49   - // aapt resource value: 0x7f050006
50   - public const int btnLaunch = 2131034118;
  65 + // aapt resource value: 0x7f060006
  66 + public const int btnLaunch = 2131099654;
51 67
52   - // aapt resource value: 0x7f05000a
53   - public const int btnPresence = 2131034122;
  68 + // aapt resource value: 0x7f06000a
  69 + public const int btnPresence = 2131099658;
54 70
55   - // aapt resource value: 0x7f050005
56   - public const int btnProxy = 2131034117;
  71 + // aapt resource value: 0x7f060005
  72 + public const int btnProxy = 2131099653;
57 73
58   - // aapt resource value: 0x7f050018
59   - public const int btnProxyCancel = 2131034136;
  74 + // aapt resource value: 0x7f060018
  75 + public const int btnProxyCancel = 2131099672;
60 76
61   - // aapt resource value: 0x7f050017
62   - public const int btnProxySave = 2131034135;
  77 + // aapt resource value: 0x7f060017
  78 + public const int btnProxySave = 2131099671;
63 79
64   - // aapt resource value: 0x7f050009
65   - public const int btnPublish = 2131034121;
  80 + // aapt resource value: 0x7f060009
  81 + public const int btnPublish = 2131099657;
66 82
67   - // aapt resource value: 0x7f050008
68   - public const int btnSubscribe = 2131034120;
  83 + // aapt resource value: 0x7f060008
  84 + public const int btnSubscribe = 2131099656;
69 85
70   - // aapt resource value: 0x7f05000d
71   - public const int btnTime = 2131034125;
  86 + // aapt resource value: 0x7f06000d
  87 + public const int btnTime = 2131099661;
72 88
73   - // aapt resource value: 0x7f05000e
74   - public const int btnUnsub = 2131034126;
  89 + // aapt resource value: 0x7f06000e
  90 + public const int btnUnsub = 2131099662;
75 91
76   - // aapt resource value: 0x7f05000f
77   - public const int btnUnsubPres = 2131034127;
  92 + // aapt resource value: 0x7f06000f
  93 + public const int btnUnsubPres = 2131099663;
78 94
79   - // aapt resource value: 0x7f050016
80   - public const int proxyPassword = 2131034134;
  95 + // aapt resource value: 0x7f060016
  96 + public const int proxyPassword = 2131099670;
81 97
82   - // aapt resource value: 0x7f050014
83   - public const int proxyPort = 2131034132;
  98 + // aapt resource value: 0x7f060014
  99 + public const int proxyPort = 2131099668;
84 100
85   - // aapt resource value: 0x7f050013
86   - public const int proxyServer = 2131034131;
  101 + // aapt resource value: 0x7f060013
  102 + public const int proxyServer = 2131099667;
87 103
88   - // aapt resource value: 0x7f050015
89   - public const int proxyUsername = 2131034133;
  104 + // aapt resource value: 0x7f060015
  105 + public const int proxyUsername = 2131099669;
90 106
91   - // aapt resource value: 0x7f050010
92   - public const int scroll = 2131034128;
  107 + // aapt resource value: 0x7f060010
  108 + public const int scroll = 2131099664;
93 109
94   - // aapt resource value: 0x7f050012
95   - public const int tbProxy = 2131034130;
  110 + // aapt resource value: 0x7f060012
  111 + public const int tbProxy = 2131099666;
96 112
97   - // aapt resource value: 0x7f050001
98   - public const int tbSsl = 2131034113;
  113 + // aapt resource value: 0x7f060001
  114 + public const int tbSsl = 2131099649;
99 115
100   - // aapt resource value: 0x7f050004
101   - public const int tvProxy = 2131034116;
  116 + // aapt resource value: 0x7f060004
  117 + public const int tvProxy = 2131099652;
102 118
103   - // aapt resource value: 0x7f050000
104   - public const int txtChannel = 2131034112;
  119 + // aapt resource value: 0x7f060000
  120 + public const int txtChannel = 2131099648;
105 121
106   - // aapt resource value: 0x7f050002
107   - public const int txtCipher = 2131034114;
  122 + // aapt resource value: 0x7f060002
  123 + public const int txtCipher = 2131099650;
108 124
109   - // aapt resource value: 0x7f050003
110   - public const int txtCustomUuid = 2131034115;
  125 + // aapt resource value: 0x7f060003
  126 + public const int txtCustomUuid = 2131099651;
111 127
112   - // aapt resource value: 0x7f050011
113   - public const int txtViewLog = 2131034129;
  128 + // aapt resource value: 0x7f060011
  129 + public const int txtViewLog = 2131099665;
114 130
115 131 private Id()
116 132 {
@@ -127,7 +143,10 @@ public partial class Layout
127 143 public const int Main = 2130903041;
128 144
129 145 // aapt resource value: 0x7f030002
130   - public const int Proxy = 2130903042;
  146 + public const int monoandroidsplash = 2130903042;
  147 +
  148 + // aapt resource value: 0x7f030003
  149 + public const int Proxy = 2130903043;
131 150
132 151 private Layout()
133 152 {
@@ -228,5 +247,17 @@ private String()
228 247 {
229 248 }
230 249 }
  250 +
  251 + public partial class Style
  252 + {
  253 +
  254 + // aapt resource value: 0x7f050000
  255 + public const int Mono_Android_Theme_Splash = 2131034112;
  256 +
  257 + private Style()
  258 + {
  259 + }
  260 + }
231 261 }
232 262 }
  263 +#pragma warning restore 1591
0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/drawable/Icon.png 100644 → 100755
0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/layout-large/Launch.axml 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/layout-large/Main.axml 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/layout/Launch.axml 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/layout/Main.axml 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/layout/Proxy.axml 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/PubNub_Messaging/Resources/values/Strings.xml 100644 → 100755
File mode changed
0  mono-for-android/3.4/Pubnub-Messaging/Pubnub-Messaging.sln 100644 → 100755
File mode changed
18 mono-for-android/3.4/Pubnub-Messaging/Pubnub-Messaging.userprefs 100644 → 100755
... ... @@ -1,23 +1,21 @@
1 1 <Properties>
2   - <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
3   - <MonoDevelop.Ide.Workbench ActiveDocument="Andr.Unit-master/Andr.Unit/PubnubUnitTest.cs">
  2 + <MonoDevelop.Ide.Workspace ActiveConfiguration="Release" />
  3 + <MonoDevelop.Ide.Workbench ActiveDocument="PubNub_Messaging/Pubnub.cs">
4 4 <Files>
5   - <File FileName="PubNub_Messaging/Pubnub.cs" Line="1626" Column="1" />
6   - <File FileName="Andr.Unit-master/Andr.Unit/PubnubUnitTest.cs" Line="5" Column="28" />
7   - <File FileName="Andr.Unit-master/Android.NUnitLite/AndrRunner/Activities/TestResultActivity.cs" Line="30" Column="40" />
  5 + <File FileName="PubNub_Messaging/Pubnub.cs" Line="361" Column="60" />
  6 + <File FileName="Andr.Unit-master/Android.NUnitLite/AndrRunner/Activities/TestResultActivity.cs" Line="1" Column="1" />
  7 + <File FileName="Andr.Unit-master/Andr.Unit/PubnubUnitTest.cs" Line="16" Column="4" />
8 8 </Files>
9 9 <Pads>
10 10 <Pad Id="ProjectPad">
11 11 <State expanded="True">