protected override void OnOpen(TimeSpan timeout)
        {
            try
            {
                var ct = GetCancellationTokenForTimeout(timeout);
                base.InitializeSocket(BrokeredServiceClient.ConnectAsync(Via.PathAndQuery, ct).GetResultOrException());
            }
            catch (SocketException socketException)
            {
                throw ConvertSocketException(socketException, "Connect");
            }

            base.OnOpen(timeout);
        }
 protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
 {
     return(Tap.Run(callback, state, async() =>
     {
         try
         {
             var ct = GetCancellationTokenForTimeout(timeout);
             base.InitializeSocket(await BrokeredServiceClient.ConnectAsync(Via.PathAndQuery, ct));
         }
         catch (SocketException socketException)
         {
             throw ConvertSocketException(socketException, "Connect");
         }
     }));
 }