code: @Override
      public int getListeningPort(String chainName) throws ChainException {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
              Tr.entry(tc, "getListeningPort: " + chainName);
          }
  
          int listeningPort = -1;
          // Search the runtime chain list for the specified chain.
          Chain chain = this.chainRunningMap.get(chainName);
          if (null == chain) {
              throw new ChainException("Chain " + chainName + " not found in runtime.");
          }
          // Found the chain. Pull out the data on the chain.
          ChainData chainData = chain.getChainData();
          if (chainData.getType().equals(FlowType.INBOUND)) {
              ChannelData channelData = chainData.getChannelList()[0];
              Map<Object, Object> channelProperties = channelData.getPropertyBag();
              if (channelProperties != null) {
                  String portString = (String) channelProperties.get(ChannelFrameworkConstants.PORT);
                  if (portString != null && !portString.trim().equals("0")) {
                      listeningPort = Integer.parseInt(portString);
                  } else {
                      // Port is not directly set. Check listenPort (in cases where port is
                      // config'd as *.
                      portString = (String) channelProperties.get(ChannelFrameworkConstants.LISTENING_PORT);
                      if (portString != null) {
                          listeningPort = Integer.parseInt(portString);
                      } else {
                          throw new ChainException("Chain " + chainName + " has no port in the device channel properties.");
                      }
                  }
              } else {
                  throw new ChainException("Chain " + chainName + " has no properties.");
              }
          } else {
              throw new ChainException("Chain " + chainName + " is not inbound.");
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
              Tr.exit(tc, "getListeningPort: " + listeningPort);
          }
          return listeningPort;
      }
docs: /*
  @see
  com.ibm.wsspi.channelfw.ChannelFramework#getListeningPort(java.lang.String)