protected final void init(ProtocolStackConfigurator configurator) throws Exception { List<ProtocolConfiguration> configs = configurator.getProtocolStack(); // replace vars with system props configs.forEach(ProtocolConfiguration::substituteVariables); prot_stack = new ProtocolStack(this); prot_stack.setup(configs); // Setup protocol stack (creates protocol, calls init() on them) }
public ProtocolTester(String prot_spec, Protocol harness) throws Exception { if (prot_spec == null || harness == null) throw new Exception("ProtocolTester(): prot_spec or harness is null"); props = prot_spec; this.harness = harness; props = "LOOPBACK:" + props; // add a loopback layer at the bottom of the stack config = new Configurator(); JChannel mock_channel = new JChannel() {}; ProtocolStack stack = new ProtocolStack(mock_channel); stack.setup(Configurator.parseConfigurations(props)); stack.insertProtocol(harness, ProtocolStack.ABOVE, stack.getTopProtocol().getClass()); bottom = stack.getBottomProtocol(); // has to be set after StartProtocolStack, otherwise the up and down handler threads in the // harness // will be started as well (we don't want that) ! // top.setUpProtocol(harness); }
protected final void init(JChannel ch) throws Exception { if (ch == null) throw new IllegalArgumentException("channel is null"); prot_stack = new ProtocolStack(this); prot_stack.setup( ch.getProtocolStack()); // Setup protocol stack (creates protocol, calls init() on them) }