- public static Optional<InetSocketAddress> extractTCPNetconfAddress(BundleContext context) {
- return extractSomeNetconfAddress(context, InfixProp.tcp);
+ public static InetSocketAddress extractTCPNetconfAddress(BundleContext context, String exceptionMessageIfNotFound) {
+
+ Optional<InetSocketAddress> inetSocketAddressOptional = extractSomeNetconfAddress(context, InfixProp.tcp);
+ if (inetSocketAddressOptional.isPresent() == false) {
+ throw new IllegalStateException("Netconf tcp address not found." + exceptionMessageIfNotFound);
+ }
+ return inetSocketAddressOptional.get();