code: public InputStream getInputStream(URI uri, SecurityDomain securityDomain) throws NoSecurityDomainException, MalformedURLException, IOException, NoSuchAlgorithmException {
          final NodeAuthModuleContext context = NodeAuthModuleContext.getContext();
          if (!context.isTLSEnabled() && !context.isNonTLSConnectionsPermitted()) {
              throw new NoSuchAlgorithmException("TLS has been disabled for ATNA connections");
          }
  
          boolean tlsURI = uri.getScheme().equalsIgnoreCase("https");
          boolean useTLS = tlsURI && context.isTLSEnabled() || !context.isNonTLSConnectionsPermitted();
  
          if (useTLS && null == securityDomain) {
              throw new NoSecurityDomainException(uri, "Security domain provided is null");
          }
  
          if (useTLS) {
              securityDomain.setDomainEnvironment();
          }
          InputStream is = null;
          try {
              URLConnection connection = uri.toURL().openConnection();
  
              if (useTLS && !securityDomain.doDomainSpoofCheck()) {
                  ((HttpsURLConnection) connection).setHostnameVerifier((urlHostName, session) -> true);
              }
  
              is = connection.getInputStream();
              if (useTLS) {
                  logger.info("Secure connection successfully made using TLS to " + uri.toString());
              } else {
                  logger.info("Unsecure connection successfully made to " + uri.toString());
              }
          } catch (IOException e) {
              if (useTLS) securityDomain.restoreSystemEnvironment();
              throw e;
          }
  
          if (useTLS) securityDomain.restoreSystemEnvironment();
          return is;
      }
docs: /* (non-Javadoc)
  @see org.openhealthtools.ihe.atna.nodeauth.SocketHandler#getInputStream(java.net.URI, org.openhealthtools.ihe.atna.nodeauth.SecurityDomain)