Extract the TCP port from the connection URL.

@return The TCP port, or empty string if none.
355806
private String getPort() {
        String url = getUrl();
        int i = url.indexOf("://") + 3;
        int j = url.indexOf("/", i);
        String s = i == 2 || j == -1 ? "" : url.substring(i, j);
        i = s.indexOf(":");
        return i == -1 ? "" : s.substring(i + 1);
    }
43422
public String connectionUrl() {
        String[] split = channel.replace("aeron:udp?endpoint=", "").split(":");
        String host = split[0];
        int port = Integer.parseInt(split[1]);
        return AeronConnectionInformation.of(host, port, streamId).toString();
    }
1229915
public function getPort() : string
  {
      // Check for proxy first
      $port = self::server('HTTP_X_FORWARDED_PORT');
      if ($port) {
          return (string)$port;
      }

      $protocol = (string)self::server('HTTP_X_FORWARDED_PROTO');
      if ($protocol === 'https') {
          return '443';
      }

      return (string)self::server('SERVER_PORT');
  }
1137767
public Optional<ServerPort> activePort() {
        final Server server = this.server;
        return server != null ? server.activePort() : Optional.empty();
    }
1078815
public String getName()
	{
		// do our own IP:port string, since InetAddress.toString() always prepends a '/'
		final InetSocketAddress a = conn.getRemoteAddress();
		return "link " + a.getAddress().getHostAddress() + ":" + a.getPort();
	}
125673
public int getPort()
    {
        if (port != 0) {
            return port;
        }
        else {
            final Connector connector = connectorHolder.get();
            if (connector != null) {
                Preconditions.checkState(connector.getLocalPort() > 0, "no port was set and the connector is not yet started!");
                return connector.getLocalPort();
            }
            else {
                return 0;
            }
        }
    }
800514
public int getPort() {
    final Connector[] connectors = this.server.getConnectors();
    checkState(connectors.length >= 1, "Server must have at least 1 connector");

    // The first connector is created upon initializing the server. That's the one that has the port.
    return connectors[0].getLocalPort();
  }
219336
public static String getCurrentRemoteConnectionLink(){

        if(!APILookupUtility.isLocal()) try{

            return URLEncoder.encode(APILookupUtility.getCurrentRemoteInstance().getHost(), "UTF-8") +
                            COLON_URL_ENCODED +
                            APILookupUtility.getCurrentRemoteInstance().getPort();

        }catch (IllegalStateException | UnsupportedEncodingException ignored){/*null be returned*/}

        return null;

    }
905989
@Override
    public int getRemotePort() {
        int port = this.connection.getRemotePort();
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "getRemotePort: " + port);
        }
        return port;
    }
438162
public java.lang.String getRequestUrl() {
    java.lang.Object ref = requestUrl_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      requestUrl_ = s;
      return s;
    }
  }
16429
protected int getFreePort() {
        ServerSocket ss;
        int freePort = 0;

        for (int i = 0; i < 10; i++) {
            freePort = (int) (10000 + Math.round(Math.random() * 10000));
            freePort = freePort % 2 == 0 ? freePort : freePort + 1;
            try {
                ss = new ServerSocket(freePort);
                freePort = ss.getLocalPort();
                ss.close();
                return freePort;
            }
            catch (IOException e) {
                LOGGER.log(Level.WARNING, "exception", e);
            }
        }
        try {
            ss = new ServerSocket(0);
            freePort = ss.getLocalPort();
            ss.close();
        }
        catch (IOException e) {
            LOGGER.log(Level.WARNING, "exception", e);
        }
        return freePort;
    }
259510
static public String getExternalIpAddress(){
		String ip = null;
		URL url = null;
		BufferedReader in = null;
		
		for (int i = 0; !isIPv4Address(ip) && i < CHECK_IP_ENDPOINTS.length; i ++, url = null, in = null){
			try{
				url = new URL(CHECK_IP_ENDPOINTS[i]);
				in = new BufferedReader(new InputStreamReader(url.openStream()));
				ip = in.readLine(); //you get the IP as a String
			}catch(Exception e){
				System.err.println("Unable to find out external IP address through end point '" + CHECK_IP_ENDPOINTS[i] + "': " + e.getMessage());
				if (in != null){
					try{
						in.close();
					}catch(Exception e2){
						// ignore
					}
				}
			}
		}
		return ip;
		
	}
1054091
protected HttpURLConnection getConnection() {
        try {
            HttpURLConnection connection;
            if (proxy != null) {
                connection = (HttpURLConnection) sentryUrl.openConnection(proxy);
            } else {
                connection = (HttpURLConnection) sentryUrl.openConnection();
            }

            if (bypassSecurity && connection instanceof HttpsURLConnection) {
                ((HttpsURLConnection) connection).setHostnameVerifier(NAIVE_VERIFIER);
            }
            connection.setRequestMethod("POST");
            connection.setDoOutput(true);
            connection.setConnectTimeout(connectionTimeout);
            connection.setReadTimeout(readTimeout);
            connection.setRequestProperty(USER_AGENT, SentryEnvironment.getSentryName());
            connection.setRequestProperty(SENTRY_AUTH, getAuthHeader());

            if (marshaller.getContentType() != null) {
                connection.setRequestProperty("Content-Type", marshaller.getContentType());
            }

            if (marshaller.getContentEncoding() != null) {
                connection.setRequestProperty("Content-Encoding", marshaller.getContentEncoding());
            }

            return connection;
        } catch (IOException e) {
            throw new IllegalStateException("Couldn't set up a connection to the Sentry server.", e);
        }
    }
827637
public SockAddr getBroadAddr() {
		SockAddr sockAddr = null;
		if (this.broadaddr != null) {
			sockAddr = new SockAddr(this.broadaddr.getSaFamily().getValue(), this.broadaddr.getData());
		}
		return sockAddr;
	}
1280439
public String getRemoteAddr() {
        if (remoteAddrHeader != null) {
            String val = getHeader(remoteAddrHeader);
            if (val != null) return val;
        }
        SocketAddress addr = getRemoteAddress();
        if (addr == null) return "";
        if (addr instanceof InetSocketAddress) return ((InetSocketAddress) addr).getAddress().getHostAddress();
        return String.valueOf(addr);
    }
393260
@Override
  public int portLocal()
  {
    SocketChannel s = _channel;
    
    if (s != null) {
      try {
        InetSocketAddress addr = (InetSocketAddress) s.getLocalAddress();
        
        return addr.getPort();
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
    else {
      return -1;
    }
  }
1326308
@Override
	public String getName()
    {
    	return (usingSSL ? PacketTransportType.TCPS : PacketTransportType.TCP)+"-"+listenAddr+"-"+listenPort;
    }