Ejemplo n.º 1
0
        public Shell(
            ICommandScheduler <JupyterRequestContext> scheduler,
            ConnectionInformation connectionInformation)
        {
            if (connectionInformation == null)
            {
                throw new ArgumentNullException(nameof(connectionInformation));
            }

            _scheduler = scheduler ?? throw new ArgumentNullException(nameof(scheduler));

            _shellAddress   = $"{connectionInformation.Transport}://{connectionInformation.IP}:{connectionInformation.ShellPort}";
            _ioPubAddress   = $"{connectionInformation.Transport}://{connectionInformation.IP}:{connectionInformation.IOPubPort}";
            _stdInAddress   = $"{connectionInformation.Transport}://{connectionInformation.IP}:{connectionInformation.StdinPort}";
            _controlAddress = $"{connectionInformation.Transport}://{connectionInformation.IP}:{connectionInformation.ControlPort}";

            var signatureAlgorithm = connectionInformation.SignatureScheme.Replace("-", string.Empty).ToUpperInvariant();

            _signatureValidator = new SignatureValidator(connectionInformation.Key, signatureAlgorithm);
            _shell       = new RouterSocket();
            _ioPubSocket = new PublisherSocket();
            _stdIn       = new RouterSocket();
            _control     = new RouterSocket();

            _shellSender = new MessageSender(_shell, _signatureValidator);
            _ioPubSender = new MessageSender(_ioPubSocket, _signatureValidator);

            _disposables = new CompositeDisposable
            {
                _shell,
                _ioPubSocket,
                _stdIn,
                _control
            };
            _messageBuilder = new MessageBuilder();
        }
Ejemplo n.º 2
0
 public MessageSender(IOutgoingSocket socket, SignatureValidator signatureValidator)
 {
     _socket             = socket ?? throw new ArgumentNullException(nameof(socket));
     _signatureValidator = signatureValidator ?? throw new ArgumentNullException(nameof(signatureValidator));
 }