@Test public void testProxyArgAppenderWithSuccess() { String actualNmapArg = nmapOsDetectorService.appendProxyArgument("--existing-arguments", "http: assertEquals("--existing-arguments --proxies http: }
@NotNull public String appendProxyArgument(String nmapArguments, String proxyHost, String proxyPort) { try { URL proxyUrl = new URL(proxyHost); if (!isValidIpPort(proxyPort)) { throw new IllegalArgumentException(format("The '%s' input does not contain a valid port.", PROXY_PORT)); } nmapArguments += " --proxies " + proxyUrl.getProtocol() + ": } catch (MalformedURLException e) { throw new IllegalArgumentException(format("The '%s' input does not contain a valid URL: %s.", PROXY_HOST, e.getMessage())); } return nmapArguments; }
NmapOsDetectorService implements OperatingSystemDetector { @NotNull public String appendProxyArgument(String nmapArguments, String proxyHost, String proxyPort) { try { URL proxyUrl = new URL(proxyHost); if (!isValidIpPort(proxyPort)) { throw new IllegalArgumentException(format("The '%s' input does not contain a valid port.", PROXY_PORT)); } nmapArguments += " --proxies " + proxyUrl.getProtocol() + ": } catch (MalformedURLException e) { throw new IllegalArgumentException(format("The '%s' input does not contain a valid URL: %s.", PROXY_HOST, e.getMessage())); } return nmapArguments; } }
NmapOsDetectorService implements OperatingSystemDetector { @NotNull public String appendProxyArgument(String nmapArguments, String proxyHost, String proxyPort) { try { URL proxyUrl = new URL(proxyHost); if (!isValidIpPort(proxyPort)) { throw new IllegalArgumentException(format("The '%s' input does not contain a valid port.", PROXY_PORT)); } nmapArguments += " --proxies " + proxyUrl.getProtocol() + ": } catch (MalformedURLException e) { throw new IllegalArgumentException(format("The '%s' input does not contain a valid URL: %s.", PROXY_HOST, e.getMessage())); } return nmapArguments; } NmapOsDetectorService(OsDetectorHelperService osDetectorHelperService); }
NmapOsDetectorService implements OperatingSystemDetector { @NotNull public String appendProxyArgument(String nmapArguments, String proxyHost, String proxyPort) { try { URL proxyUrl = new URL(proxyHost); if (!isValidIpPort(proxyPort)) { throw new IllegalArgumentException(format("The '%s' input does not contain a valid port.", PROXY_PORT)); } nmapArguments += " --proxies " + proxyUrl.getProtocol() + ": } catch (MalformedURLException e) { throw new IllegalArgumentException(format("The '%s' input does not contain a valid URL: %s.", PROXY_HOST, e.getMessage())); } return nmapArguments; } NmapOsDetectorService(OsDetectorHelperService osDetectorHelperService); @Override OperatingSystemDetails detectOs(OsDetectorInputs osDetectorInputs); @NotNull String appendProxyArgument(String nmapArguments, String proxyHost, String proxyPort); }
NmapOsDetectorService implements OperatingSystemDetector { @NotNull public String appendProxyArgument(String nmapArguments, String proxyHost, String proxyPort) { try { URL proxyUrl = new URL(proxyHost); if (!isValidIpPort(proxyPort)) { throw new IllegalArgumentException(format("The '%s' input does not contain a valid port.", PROXY_PORT)); } nmapArguments += " --proxies " + proxyUrl.getProtocol() + ": } catch (MalformedURLException e) { throw new IllegalArgumentException(format("The '%s' input does not contain a valid URL: %s.", PROXY_HOST, e.getMessage())); } return nmapArguments; } NmapOsDetectorService(OsDetectorHelperService osDetectorHelperService); @Override OperatingSystemDetails detectOs(OsDetectorInputs osDetectorInputs); @NotNull String appendProxyArgument(String nmapArguments, String proxyHost, String proxyPort);  }