public void SetUp() { Configurator.Configure(); _connectionListener = new LidgrenServerConnectionListener(_applicationId, _listenAddress, _port, new BinaryMessageSerializer(), new UnencryptedCryptoProviderResolver()); _dispatcher = new OperationDispatcher(); _dispatcher.RegisterHandler <ICalculator>(new Calculator()); _dispatcher.RegisterHandler <IGreeter>(new Greeter()); _server = new GenericServerEndpoint(_connectionListener, new ServerConfig(), () => _dispatcher); _server.Start(); }
public void ValidateIpEndPointProvision() { connectionListener = new LidgrenServerConnectionListener(applicationId, ListenAddress, Port, new BinaryMessageSerializer(), new UnencryptedCryptoProviderResolver()); dispatcher = new OperationDispatcher(); IPEndPoint senderEndPoint = null; IPEndPoint clientEndPoint = null; dispatcher.RegisterHandler <IEndPointProvisioner>(new EndPointProvisioner { OnStuff = e => senderEndPoint = e }); server = new GenericServerEndpoint(connectionListener, new ServerConfig(), () => dispatcher); server.Start(); using (ClientConnection client = CreateClientConnection()) { client.Open(); clientEndPoint = client.GetClientEndpoint(); client.RemoteExecutor.Create <IEndPointProvisioner>().DoStuff(null); } server.Dispose(); Assert.AreEqual(clientEndPoint, senderEndPoint); }
public void Should_start_endpoint() { _subject.Start(); _connectionListener.AssertWasCalled(l => l.StartListening()); }