HttpServiceUtil { public static int getHttpServicePortSecure(final BundleContext bc) { return getHttpServicePortProperty(bc, "org.osgi.service.http.port.secure"); } private  HttpServiceUtil(); static int getHttpServicePort(final BundleContext bc); static int getHttpServicePortSecure(final BundleContext bc);  }
@Test public void shouldReturnHttpServicePortSecureFromServiceReference() { int port = HttpServiceUtil.getHttpServicePortSecure(bundleContext); assertThat(port, is(48080)); }
@Test public void shouldReturnHttpServicePortSecureFromSystemProperty() throws InvalidSyntaxException { when(bundleContext.getAllServiceReferences(ORG_OSGI_SERVICE_HTTP_SERVICE, null)) .thenReturn(new ServiceReference[0]); when(bundleContext.getProperty(HTTP_PORT_SECURE)).thenReturn("49090"); int port = HttpServiceUtil.getHttpServicePortSecure(bundleContext); assertThat(port, is(49090)); }