@@ -145,7 +145,7 @@ public class ConnectionFactory : ConnectionFactoryBase, IAsyncConnectionFactory
145
145
/// Default SASL auth mechanisms to use.
146
146
/// </summary>
147
147
public static readonly IList < AuthMechanismFactory > DefaultAuthMechanisms =
148
- new List < AuthMechanismFactory > ( ) { new PlainMechanismFactory ( ) } ;
148
+ new List < AuthMechanismFactory > ( ) { new PlainMechanismFactory ( ) } ;
149
149
150
150
/// <summary>
151
151
/// SASL auth mechanisms to use.
@@ -174,6 +174,9 @@ public class ConnectionFactory : ConnectionFactoryBase, IAsyncConnectionFactory
174
174
private TimeSpan m_handshakeContinuationTimeout = TimeSpan . FromSeconds ( 10 ) ;
175
175
private TimeSpan m_continuationTimeout = TimeSpan . FromSeconds ( 20 ) ;
176
176
177
+ // just here to hold the value that was set through the setter
178
+ private Uri uri ;
179
+
177
180
/// <summary>
178
181
/// Amount of time protocol handshake operations are allowed to take before
179
182
/// timing out.
@@ -311,6 +314,15 @@ public AmqpTcpEndpoint Endpoint
311
314
/// </summary>
312
315
public string VirtualHost { get ; set ; } = DefaultVHost ;
313
316
317
+ /// <summary>
318
+ /// Username to use when authenticating to the server.
319
+ /// </summary>
320
+ public Uri Uri
321
+ {
322
+ get { return uri ; }
323
+ set { SetUri ( value ) ; }
324
+ }
325
+
314
326
/// <summary>
315
327
/// Given a list of mechanism names supported by the server, select a preferred mechanism,
316
328
/// or null if we have none in common.
@@ -488,13 +500,13 @@ public IFrameHandler CreateFrameHandlerForHostname(string hostname)
488
500
private IFrameHandler ConfigureFrameHandler ( IFrameHandler fh )
489
501
{
490
502
// make sure socket timeouts are higher than heartbeat
491
- fh . ReadTimeout = Math . Max ( SocketReadTimeout , RequestedHeartbeat * 1000 ) ;
503
+ fh . ReadTimeout = Math . Max ( SocketReadTimeout , RequestedHeartbeat * 1000 ) ;
492
504
fh . WriteTimeout = Math . Max ( SocketWriteTimeout , RequestedHeartbeat * 1000 ) ;
493
505
// TODO: add user-provided configurator, like in the Java client
494
506
return fh ;
495
507
}
496
508
497
- public void SetUri ( Uri uri )
509
+ private void SetUri ( Uri uri )
498
510
{
499
511
Endpoint = new AmqpTcpEndpoint ( ) ;
500
512
@@ -554,6 +566,8 @@ that has at least the path segment "/". */
554
566
{
555
567
VirtualHost = UriDecode ( uri . Segments [ 1 ] ) ;
556
568
}
569
+
570
+ this . uri = uri ;
557
571
}
558
572
559
573
///<summary>
@@ -564,7 +578,7 @@ private static string UriDecode(string uri)
564
578
return System . Uri . UnescapeDataString ( uri . Replace ( "+" , "%2B" ) ) ;
565
579
}
566
580
567
- private List < AmqpTcpEndpoint > LocalEndpoints ( )
581
+ private List < AmqpTcpEndpoint > LocalEndpoints ( )
568
582
{
569
583
return new List < AmqpTcpEndpoint > { this . Endpoint } ;
570
584
}
0 commit comments