Buggy code:
public class UndertowDeploymentInfoService implements Service < DeploymentInfo > { public static final ServiceName SERVICE_NAME = ServiceName . of ( "UndertowDeploymentInfoService" ) ; private static final String TEMP_DIR = "jboss.server.temp.dir" ; private DeploymentInfo deploymentInfo ; private final JBossWebMetaData mergedMetaData ; private final String deploymentName ; private final TldsMetaData tldsMetaData ; private final List < TldMetaData > sharedTlds ; private final Module module ; private final ScisMetaData scisMetaData ; private final VirtualFile deploymentRoot ; private final String jaccContextId ; private final String securityDomain ; private final List < ServletContextAttribute > attributes ; private final String contextPath ; private final List < SetupAction > setupActions ; private final Set < VirtualFile > overlays ; private final List < ExpressionFactoryWrapper > expressionFactoryWrappers ; private final List < PredicatedHandler > predicatedHandlers ; private final List < HandlerWrapper > initialHandlerChainWrappers ; private final List < HandlerWrapper > innerHandlerChainWrappers ; private final List < HandlerWrapper > outerHandlerChainWrappers ; private final List < ThreadSetupAction > threadSetupActions ; private final boolean explodedDeployment ; private final InjectedValue < UndertowService > undertowService = new InjectedValue ( ) ; private final InjectedValue < SessionManagerFactory > sessionManagerFactory = new InjectedValue ( ) ; private final InjectedValue < SessionIdentifierCodec > sessionIdentifierCodec = new InjectedValue ( ) ; private final InjectedValue < SecurityDomainContext > securityDomainContextValue = new InjectedValue < SecurityDomainContext > ( ) ; private final InjectedValue < ServletContainerService > container = new InjectedValue ( ) ; private final InjectedValue < PathManager > pathManagerInjector = new InjectedValue < PathManager > ( ) ; private final InjectedValue < ComponentRegistry > componentRegistryInjectedValue = new InjectedValue ( ) ; private final InjectedValue < Host > host = new InjectedValue ( ) ; private final Map < String , InjectedValue < Executor > > executorsByName = new HashMap < String , InjectedValue < Executor > > ( ) ; private UndertowDeploymentInfoService ( final JBossWebMetaData mergedMetaData , final String deploymentName , final TldsMetaData tldsMetaData , final List < TldMetaData > sharedTlds , final Module module , final ScisMetaData scisMetaData , final VirtualFile deploymentRoot , final String jaccContextId , final String securityDomain , final List < ServletContextAttribute > attributes , final String contextPath , final List < SetupAction > setupActions , final Set < VirtualFile > overlays , final List < ExpressionFactoryWrapper > expressionFactoryWrappers , List < PredicatedHandler > predicatedHandlers , List < HandlerWrapper > initialHandlerChainWrappers , List < HandlerWrapper > innerHandlerChainWrappers , List < HandlerWrapper > outerHandlerChainWrappers , List < ThreadSetupAction > threadSetupActions , boolean explodedDeployment ) { } @ Override public synchronized void start ( final StartContext startContext ) throws StartException { } @ Override public synchronized void stop ( final StopContext stopContext ) { } @ Override public synchronized DeploymentInfo getValue ( ) throws IllegalArgumentException , IllegalStateException { } private void handleJASPIMechanism ( final DeploymentInfo deploymentInfo ) { } private void handleJACCAuthorization ( final DeploymentInfo deploymentInfo ) { } private void handleIdentityManager ( final DeploymentInfo deploymentInfo ) { } private ConfidentialPortManager getConfidentialPortManager ( ) { return new ConfidentialPortManager ( ) { @ Override public int getConfidentialPort ( HttpServerExchange exchange ) { <START_BUG> int port = exchange . getHostPort ( ) ; <END_BUG> return host . getValue ( ) . getServer ( ) . getValue ( ) . lookupSecurePort ( port ) ; } } ; } private void handleDistributable ( final DeploymentInfo deploymentInfo ) { } private String resolveContextPath ( ) { } private DeploymentInfo createServletConfig ( ) throws StartException { } private void handleServletMappings ( boolean is22OrOlder , Set < String > seenMappings , Map < String , List < ServletMappingMetaData > > servletMappings , ServletInfo s ) { } private static List < AuthMethodConfig > authMethod ( String configuredMethod ) { } private static TransportGuaranteeType transportGuaranteeType ( final TransportGuaranteeType type ) { } private static HashMap < String , JspPropertyGroup > createJspConfig ( JBossWebMetaData metaData ) { } private static HashMap < String , TagLibraryInfo > createTldsInfo ( final TldsMetaData tldsMetaData , List < TldMetaData > sharedTlds ) throws ClassNotFoundException { } private static TagLibraryInfo createTldInfo ( final String location , final TldMetaData tldMetaData , final HashMap < String , TagLibraryInfo > ret ) throws ClassNotFoundException { } private static void addListener ( final ClassLoader classLoader , final ComponentRegistry components , final DeploymentInfo d , final ListenerMetaData listener ) throws ClassNotFoundException { } private static < T > InstanceFactory < T > createInstanceFactory ( final ManagedReferenceFactory creator ) { } public void addInjectedExecutor ( final String name , final InjectedValue < Executor > injected ) { } public InjectedValue < ServletContainerService > getContainer ( ) { } public InjectedValue < SecurityDomainContext > getSecurityDomainContextValue ( ) { } public Injector < SessionManagerFactory > getSessionManagerFactoryInjector ( ) { } public Injector < SessionIdentifierCodec > getSessionIdentifierCodecInjector ( ) { } public InjectedValue < UndertowService > getUndertowService ( ) { } public InjectedValue < PathManager > getPathManagerInjector ( ) { } public InjectedValue < ComponentRegistry > getComponentRegistryInjectedValue ( ) { } public InjectedValue < Host > getHost ( ) { } private static class ComponentClassIntrospector implements ClassIntrospecter { private final ComponentRegistry componentRegistry ; public ComponentClassIntrospector ( final ComponentRegistry componentRegistry ) { } @ Override public < T > InstanceFactory < T > createInstanceFactory ( final Class < T > clazz ) throws NoSuchMethodException { } } private static class ManagedReferenceInstanceFactory < T > implements InstanceFactory < T > { private final ManagedReferenceFactory component ; public ManagedReferenceInstanceFactory ( final ManagedReferenceFactory component ) { } @ Override public InstanceHandle < T > createInstance ( ) throws InstantiationException { } } public static UndertowDeploymentInfoService . Builder builder ( ) { } public static class Builder { private JBossWebMetaData mergedMetaData ; private String deploymentName ; private TldsMetaData tldsMetaData ; private List < TldMetaData > sharedTlds ; private Module module ; private ScisMetaData scisMetaData ; private VirtualFile deploymentRoot ; private String jaccContextId ; private List < ServletContextAttribute > attributes ; private String contextPath ; private String securityDomain ; private List < SetupAction > setupActions ; private Set < VirtualFile > overlays ; private List < ExpressionFactoryWrapper > expressionFactoryWrappers ;

Fix:
int port = exchange . getDestinationAddress ( ) . getPort ( ) ;