fix for: https://issues.apache.org/activemq/browse/AMQNET-281
diff --git a/src/main/csharp/ConnectionFactory.cs b/src/main/csharp/ConnectionFactory.cs
index ae2e3bd..608fa21 100755
--- a/src/main/csharp/ConnectionFactory.cs
+++ b/src/main/csharp/ConnectionFactory.cs
@@ -160,9 +160,13 @@
{
brokerUri = new Uri(URISupport.StripPrefix(value.OriginalString, "stomp:"));
- if(brokerUri.Query != null)
+ if(!String.IsNullOrEmpty(brokerUri.Query) && !brokerUri.OriginalString.EndsWith(")"))
{
- StringDictionary properties = URISupport.ParseQuery(brokerUri.Query);
+ // Since the Uri class will return the end of a Query string found in a Composite
+ // URI we must ensure that we trim that off before we proceed.
+ string query = brokerUri.Query.Substring(brokerUri.Query.LastIndexOf(")") + 1);
+
+ StringDictionary properties = URISupport.ParseQuery(query);
StringDictionary connection = URISupport.ExtractProperties(properties, "connection.");
StringDictionary nms = URISupport.ExtractProperties(properties, "nms.");
diff --git a/src/test/csharp/NMSConnectionFactoryTest.cs b/src/test/csharp/NMSConnectionFactoryTest.cs
index 42c3842..238b0b9 100755
--- a/src/test/csharp/NMSConnectionFactoryTest.cs
+++ b/src/test/csharp/NMSConnectionFactoryTest.cs
@@ -28,6 +28,8 @@
[Test]
#if !NETCF
[TestCase("stomp:tcp://${activemqhost}:61613")]
+ [TestCase("stomp:failover:(tcp://${activemqhost}:61616?keepAlive=false&wireFormat.maxInactivityDuration=1000)")]
+ [TestCase("stomp:failover:(tcp://${activemqhost}:61616?keepAlive=false&wireFormat.maxInactivityDuration=1000)?connection.asyncSend=false")]
[TestCase("stomp:tcp://${activemqhost}:61613?connection.asyncsend=false")]
[TestCase("stomp:tcp://${activemqhost}:61613?connection.InvalidParameter=true", ExpectedException = typeof(NMSConnectionException))]
[TestCase("stomp:tcp://${activemqhost}:61613?connection.InvalidParameter=true", ExpectedException = typeof(NMSConnectionException))]