Buggy code:
public final class ServerConfigImpl extends AbstractServerConfig implements AbstractServerConfigMBean { private final InjectedValue < MBeanServer > injectedMBeanServer = new InjectedValue < MBeanServer > ( ) ; private final InjectedValue < ServerEnvironment > injectedServerEnvironment = new InjectedValue < ServerEnvironment > ( ) ; private final InjectedValue < UndertowService > injectedUndertowService = new InjectedValue < UndertowService > ( ) ; private final AtomicInteger wsDeploymentCount = new AtomicInteger ( 0 ) ; private final ServerConfigImpl . DMRSynchCheckHandler webServiceHostUCH = new ServerConfigImpl . DMRSynchCheckHandler ( ) ; private final ServerConfigImpl . DMRSynchCheckHandler webServicePortUCH = new ServerConfigImpl . DMRSynchCheckHandler ( ) ; private final ServerConfigImpl . DMRSynchCheckHandler webServiceSecurePortUCH = new ServerConfigImpl . DMRSynchCheckHandler ( ) ; private final ServerConfigImpl . DMRSynchCheckHandler webServiceUriSchemeUCH = new ServerConfigImpl . DMRSynchCheckHandler ( ) ; private final ServerConfigImpl . DMRSynchCheckHandler modifySOAPAddressUCH = new ServerConfigImpl . DMRSynchCheckHandler ( ) ; private final ServerConfigImpl . DMRSynchCheckHandler webServicePathRewriteRuleUCH = new ServerConfigImpl . DMRSynchCheckHandler ( ) ; private ServerConfigImpl ( ) { } @ Override public void create ( ) throws Exception { } public void incrementWSDeploymentCount ( ) { } public void decrementWSDeploymentCount ( ) { } protected boolean isModifiable ( ) { } public void setWebServiceHost ( String host , boolean forceUpdate ) throws UnknownHostException { } @ Override public void setWebServiceHost ( String host ) throws UnknownHostException { } public void setWebServicePathRewriteRule ( String path , boolean forceUpdate ) { } @ Override public void setWebServicePathRewriteRule ( String path ) { } public void setWebServicePort ( int port , boolean forceUpdate ) { } @ Override public void setWebServicePort ( int port ) { } public void setWebServiceSecurePort ( int port , boolean forceUpdate ) { } public void setWebServiceUriScheme ( String scheme , boolean forceUpdate ) { } @ Override public void setWebServiceSecurePort ( int port ) { } public void setModifySOAPAddress ( boolean flag , boolean forceUpdate ) { } @ Override public void setModifySOAPAddress ( boolean flag ) { } public File getServerTempDir ( ) { } public File getHomeDir ( ) { } public File getServerDataDir ( ) { } @ Override public MBeanServer getMbeanServer ( ) { } @ Override public void setMbeanServer ( final MBeanServer mbeanServer ) { } public InjectedValue < MBeanServer > getMBeanServerInjector ( ) { } public InjectedValue < ServerEnvironment > getServerEnvironmentInjector ( ) { } public InjectedValue < UndertowService > getUndertowServiceInjector ( ) { } private ServerEnvironment getServerEnvironment ( ) { } private UndertowService getUndertowService ( ) { } public static ServerConfigImpl newInstance ( ) { } public void setClientConfigWrapper ( ClientConfig config , boolean reload ) { } @ Override public Integer getVirtualHostPort ( String hostname , boolean securePort ) { ServerHostInfo hostInfo = new ServerHostInfo ( hostname ) ; Host undertowHost = getUndertowHost ( hostInfo ) ; if ( ( undertowHost != null ) && ( ! ( undertowHost . getServer ( ) . getListeners ( ) . isEmpty ( ) ) ) ) { if ( ! securePort ) { <START_BUG> return undertowHost . getServer ( ) . getListeners ( ) . get ( 0 ) . getBinding ( ) . getValue ( ) . getAbsolutePort ( ) ; <END_BUG> } else { for ( ListenerService < ? > listener : undertowHost . getServer ( ) . getListeners ( ) ) { if ( listener . isSecure ( ) ) { return listener . getBinding ( ) . getValue ( ) . getPort ( ) ; } } } } return null ; } @ Override public String getHostAlias ( String hostname ) { } private class DMRSynchCheckHandler implements UpdateCallbackHandler { private volatile boolean dmrSynched = true ; @ Override public void onBeforeUpdate ( ) { } public void reset ( ) { } } private Host getUndertowHost ( final ServerHostInfo info ) { } }

Fix:
return undertowHost . getServer ( ) . getListeners ( ) . get ( 0 ) . getBinding ( ) . getValue ( ) . getPort ( ) ;