Sets the port number for the proxy.

@param port The port number for the proxy.
@return The new proxy, never {@code null}.
162473
public Proxy setPort( int port )
    {
        if ( this.port == port )
        {
            return this;
        }
        return new Proxy( type, host, port, auth );
    }
377870
protected function setPort($port)
    {
        $this->uriString = null;

        if (null === $port) {
            $this->port = null;

            return $this;
        }

        if (! $this->isPortValid($port)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid port "%s" provided.',
                (is_object($port) ? get_class($port) : gettype($port))
            ));
        }
        $this->port = (int) $port;

        return $this;
    }
907807
public final UdpClient port(int port) {
		return bootstrap(b -> b.remoteAddress(getHost(b), port));
	}
908110
public void setNetworkSourcePort(java.util.Collection<NumberFilter> networkSourcePort) {
        if (networkSourcePort == null) {
            this.networkSourcePort = null;
            return;
        }

        this.networkSourcePort = new java.util.ArrayList<NumberFilter>(networkSourcePort);
    }
276375
public CliCommandBuilder setConnection(final String hostname, final int port) {
        addCliArgument(CliArgument.CONNECT);
        setController(hostname, port);
        return this;
    }
1046105
public function setProxyPort($proxyPort)
    {
        if ($proxyPort != null && preg_match('/^d{4}$/', $proxyPort) !== 1) {
            if ($this->isTestSystem()) {
                throw new InvalidArgumentException("The proxy port '$proxyPort' you have given must be numeric!");
            } else {
                throw new Exception();
            }
        }

        $this->proxyPort = $proxyPort;
    }
1050621
public HostPort setPassive(int port, int queue)
        throws IOException{

        if (serverSocket == null) {
            ServerSocketFactory factory =
                ServerSocketFactory.getDefault();
            serverSocket = factory.createServerSocket(port, queue);
        }

        session.serverMode = Session.SERVER_PASSIVE;

        String address = Util.getLocalHostAddress();
        int localPort = serverSocket.getLocalPort();

        if (remoteControlChannel.isIPv6()) {
            String version = HostPort6.getIPAddressVersion(address);
            session.serverAddress =
                new HostPort6(version, address, localPort);
        } else {
            session.serverAddress =
                new HostPort(address, localPort);
        }

        logger.debug("started passive server at port " +
                     session.serverAddress.getPort());
        return session.serverAddress;

    }
879451
public void setProxy(String proxyHost, int proxyPort) {
         this.proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
     }
1044094
public ServerConfig setPort(int port) {
        if (!NetUtils.isRandomPort(port) && NetUtils.isInvalidPort(port)) {
            throw ExceptionUtils.buildRuntime("server.port", port + "",
                "port must between -1 and 65535 (-1 means random port)");
        }
        this.port = port;
        return this;
    }
1369734
public static void setProxy(String proxyAddr) {
        if (proxyAddr != null) {
            Scanner s = new Scanner(proxyAddr);
            
            // Split into "proxyAddr:proxyPort".
            proxyAddr = null;
            int proxyPort = 8080;
            try {
                s.findInLine("(http://|)([^:/]+)(:|)([0-9]*)(/|)");
                MatchResult m = s.match();
                
                if (m.groupCount() >= 2) {
                    proxyAddr = m.group(2);
                }
                
                if ((m.groupCount() >= 4) && (!m.group(4).isEmpty()))  {
                    proxyPort = Integer.parseInt(m.group(4));
                }
            } finally {
                s.close();
            }
            
            if (proxyAddr != null) {
                SocketAddress sa = new InetSocketAddress(proxyAddr, proxyPort);
                setProxy(new Proxy(Type.HTTP, sa));
            }
        }
    }
889035
public void setNetworkDestinationPort(java.util.Collection<NumberFilter> networkDestinationPort) {
        if (networkDestinationPort == null) {
            this.networkDestinationPort = null;
            return;
        }

        this.networkDestinationPort = new java.util.ArrayList<NumberFilter>(networkDestinationPort);
    }
524720
public static WebsocketServerTransport create(String bindAddress, int port) {
    Objects.requireNonNull(bindAddress, "bindAddress must not be null");

    HttpServer httpServer = HttpServer.create().host(bindAddress).port(port);
    return create(httpServer);
  }
999005
public Blade listen(int port) {
        Assert.greaterThan(port, 0, "server port not is negative number.");
        this.environment.set(ENV_KEY_SERVER_PORT, port);
        return this;
    }
842116
@Nonnull
  public final JettyStarter setPort (@Nonnegative final int nPort)
  {
    ValueEnforcer.isGT0 (nPort, "Port");
    m_nPort = nPort;
    return this;
  }
400891
public Proxy setType( String type )
    {
        if ( this.type.equals( type ) || ( type == null && this.type.length() <= 0 ) )
        {
            return this;
        }
        return new Proxy( type, host, port, auth );
    }
422079
public function setPort($port)
    {
        if ( ! is_null($port)) $port = (int) $port;

        $this->setAttribute('port', $port);

        return $this;
    }
546614
public ClientNetworkConfig addOutboundPort(int port) {
        if (outboundPorts == null) {
            outboundPorts = new HashSet<Integer>();
        }
        outboundPorts.add(port);
        return this;
    }