public void NoAuthenticationThrowsException() { JsonFormatter formatter = new JsonFormatter(); WampCraPlayground <JToken> playground = new WampCraPlayground <JToken> (formatter, new MockWampCraAuthenticaticationBuilder <JToken>()); IWampChannelFactory <JToken> channelFactory = playground.ChannelFactory; IWampHost host = playground.Host; host.HostService(new Sample()); host.Open(); IControlledWampConnection <JToken> connection = playground.CreateClientConnection(); IWampChannel <JToken> channel = channelFactory.CreateChannel(connection); channel.Open(); Task <string> result = channel.GetRpcProxy <ISampleAsync>() .Hello("Foobar"); AggregateException aggregateException = result.Exception; Exception exception = aggregateException.InnerException; WampRpcCallException casted = exception as WampRpcCallException; Assert.IsNotNull(casted); }
public void AuthenticationFailure() { JsonFormatter formatter = new JsonFormatter(); WampCraPlayground <JToken> playground = new WampCraPlayground <JToken> (formatter, new MockWampCraAuthenticaticationBuilder <JToken>()); IWampChannelFactory <JToken> channelFactory = playground.ChannelFactory; IWampHost host = playground.Host; host.HostService(new Sample()); host.Open(); IControlledWampConnection <JToken> connection = playground.CreateClientConnection(); IWampChannel <JToken> channel = channelFactory.CreateChannel(connection); channel.Open(); IWampCraProcedures proceduresProxy = channel.GetRpcProxy <IWampCraProcedures>(); WampRpcCallException callException = Assert.Throws <WampRpcCallException> (() => proceduresProxy.Authenticate(formatter, "foobar", null, "secret2")); }
public void AuthenticationSuccess() { JsonFormatter formatter = new JsonFormatter(); WampCraPlayground <JToken> playground = new WampCraPlayground <JToken> (formatter, new MockWampCraAuthenticaticationBuilder <JToken>()); IWampChannelFactory <JToken> channelFactory = playground.ChannelFactory; IWampHost host = playground.Host; host.HostService(new Sample()); host.Open(); IControlledWampConnection <JToken> connection = playground.CreateClientConnection(); IWampChannel <JToken> channel = channelFactory.CreateChannel(connection); channel.Open(); channel.GetRpcProxy <IWampCraProcedures>(). Authenticate(formatter, "foobar", null, "secret"); string result = channel.GetRpcProxy <ISample>() .Hello("Foobar"); Assert.That(result, Is.Not.Null.Or.Empty); }
/// <summary> /// Indicates that the user wants to connect to a given realm. /// </summary> /// <param name="realm">The requested realm to connect to</param> public static ChannelFactorySyntax.IRealmSyntax ConnectToRealm(this IWampChannelFactory factory, string realm) { return(new ChannelState() { ChannelFactory = factory, Realm = realm }); }
public static IWampChannel <JToken> CreateChannel(this IWampChannelFactory <JToken> factory, WebSocket socket) { return(factory.CreateChannel(new WebSocket4NetTextConnection <JToken>(socket, new Wamp1Binding()))); }
public static IWampChannel <TMessage> CreateChannel <TMessage>(this IWampChannelFactory <TMessage> factory, string address, IWampTextMessageParser <TMessage> parser) { return(factory.CreateChannel(new WebSocket4NetTextConnection <TMessage>(address, new Wamp1Binding <TMessage>(parser, factory.Formatter)))); }
/// <summary> /// Constructor /// </summary> public PoloniexExchangeMonitor(IWampChannelFactory wampChannelFactory) { _wampChannelFactory = Preconditions.CheckNotNull(wampChannelFactory); }
public static IWampChannel <TMessage> CreateChannel <TMessage>(this IWampChannelFactory <TMessage> factory, string address, IWampTextMessageParser <TMessage> parser) { return(factory.CreateChannel(address, parser, (Action <SecurityOption>)null)); }
/// <summary> /// Constructor /// </summary> public PoloniexTickerService(IWampChannelFactory wampChannelFactory) { _wampChannelFactory = Preconditions.CheckNotNull(wampChannelFactory); }