MitmDelegate extends Delegate { @Override public void applyDelegate(Config config) { config.setDefaultRunningMode(RunningModeType.MITM); if (inboundConnectionStr != null) { setInboundConnection(config); } else { LOGGER.debug("Parameter -accept not specified. Using inbound connection from " + "-workflow_input or config defaults."); } if (outboundConnectionStr != null) { setOutboundConnection(config); } else { LOGGER.debug("Parameter -connect not specified. Using outbound connection from " + "-workflow_input or config defaults."); } } MitmDelegate(); String getInboundConnectionStr(); void setInboundConnectionStr(String inboundConnectionStr); String getOutboundConnectionStr(); void setOutboundConnectionStr(String outboundConnectionStr); @Override void applyDelegate(Config config);  }
@Test public void testApplyDelegate() { config.setDefaultClientConnection(dummyClientCon); config.setDefaultServerConnection(dummyServerCon); expectedServerCon = new InboundConnection("accept:1234", 1234); expectedClientCon = new OutboundConnection("remotehost:4321", 4321, "remotehost"); args = new String[4]; args[0] = "-accept"; args[1] = "1234"; args[2] = "-connect"; args[3] = "remotehost:4321"; jcommander.parse(args); delegate.applyDelegate(config); InboundConnection actualServerCon = config.getDefaultServerConnection(); OutboundConnection actualClientCon = config.getDefaultClientConnection(); assertThat(actualServerCon, equalTo(expectedServerCon)); assertThat(actualClientCon, equalTo(expectedClientCon)); }