Ejemplo n.º 1
0
        public void Test3_InvalidSignatureFormat()
        {
            byte[] data = resources.ResourceTestV1.test3_invalid_signature_format;

            Error e = Biscuit.Token.Biscuit.FromBytes(data).Left;

            Console.WriteLine("got error: " + e);
            Assert.IsTrue(e is DeserializationError);
            DeserializationError errorDeserialized = (DeserializationError)e;

            Assert.IsTrue(errorDeserialized.e.Contains("Input must by 32 bytes"));
        }
Ejemplo n.º 2
0
 private Task RunReceiveAsync(ClientWebSocket client, TaskCompletionSource <bool> readySignal, CancellationToken cancelToken)
 {
     return(Task.Run(async() =>
     {
         while (true)
         {
             cancelToken.ThrowIfCancellationRequested();
             try
             {
                 await ReceiveAsync(client, readySignal, cancelToken).ConfigureAwait(false);
             }
             catch (SerializationException ex)
             {
                 DeserializationError?.Invoke(ex);
             }
         }
     }));
 }
Ejemplo n.º 3
0
 private Task RunReceiveAsync(ClientWebSocket client, TaskCompletionSource <bool> readySignal, CancellationToken cancelToken)
 {
     return(Task.Run(async() =>
     {
         while (true)
         {
             cancelToken.ThrowIfCancellationRequested();
             try
             {
                 await ReceiveAsync(client, readySignal, cancelToken).ConfigureAwait(false);
             }
             catch (WumpusRpcException ex) when(ex.Code == 4005)  // Unknown id
             {
                 // Ignore for now - this should be sent through to the promise that cause the error
             }
             catch (SerializationException ex)
             {
                 DeserializationError?.Invoke(ex);
             }
         }
     }));
 }
Ejemplo n.º 4
0
 protected virtual void OnDeserializationError(object error)
 {
     DeserializationError?.Invoke(this, error);
 }