Example #1
0
        public IConnectionService CreateConnectionService()
        {
            // TODO dont duplicate with real and create method
            var service           = new ConnectionService(new FakeP2PConnection(), false);
            var dispatcher        = new Caasiope.Node.Connections.Dispatcher(service.Logger);
            var blockchainChannel = service.CreateChannel(ConnectionService.BLOCKCHAIN_CHANNEL, dispatcher, new BlockchainApi().JsonMessageFactory, session => true);

            service.SetBlockchainChannel(blockchainChannel);
            return(service);
        }
Example #2
0
        public IConnectionService CreateConnectionService()
        {
            var config     = NodeBuilder.BuildConfiguration(NodeConfiguration.GetPath("node_server.txt"), NodeConfiguration.GetCertificatesPath(), "node_id.pem");
            var nodes      = P2PServerConfiguration.ToIPEndpoints(new UrlConfiguration(NodeConfiguration.GetPath("nodes.txt")).Lines);
            var connection = new Connections.P2PConnection(config, nodes, 5, 20);

            var connectionService = new ConnectionService(connection, false /*TODO to config ?*/);
            var dispatcher        = new Dispatcher(connectionService.Logger);
            var bockchainChannel  = connectionService.CreateChannel(ConnectionService.BLOCKCHAIN_CHANNEL, dispatcher, new BlockchainApi().JsonMessageFactory, session => true);

            connectionService.SetBlockchainChannel(bockchainChannel);

            return(connectionService);
        }