绑定端口到本地。 一个会话可绑定多个端口

@param session 需要绑定端口的SSH会话
@param remoteHost 远程主机
@param remotePort 远程端口
@param localPort 本地端口
@return 成功与否
@throws JschRuntimeException 端口绑定失败异常
438890
public static boolean bindPort(Session session, String remoteHost, int remotePort, int localPort) throws JschRuntimeException {
		if (session != null && session.isConnected()) {
			try {
				session.setPortForwardingL(localPort, remoteHost, remotePort);
			} catch (JSchException e) {
				throw new JschRuntimeException(e, "From [{}] mapping to [{}] error！", remoteHost, localPort);
			}
			return true;
		}
		return false;
	}
1109319
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201811.ProposalServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201811.ProposalServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201811.ProposalServiceSoapBindingStub(new java.net.URL(ProposalServiceInterfacePort_address), this);
                _stub.setPortName(getProposalServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
424511
public org.jbundle.thin.base.remote.RemoteBaseSession makeRemoteSession(String strSessionClassName) throws RemoteException
    {
        return m_tableRemote.makeRemoteSession(strSessionClassName);
    }
49639
public static Session getSession(String sshHost, int sshPort, String sshUser, String sshPass) {
		return JschSessionPool.INSTANCE.getSession(sshHost, sshPort, sshUser, sshPass);
	}
879370
public void startTransportProtocol(SshTransport provider,
			Ssh2Context context, String localIdentification,
			String remoteIdentification, Ssh2Client client) throws SshException {

		try {
			this.transportIn = new DataInputStream(provider.getInputStream());
			this.transportOut = provider.getOutputStream();
			this.provider = provider;
			this.localIdentification = localIdentification;
			this.remoteIdentification = remoteIdentification;
			this.transportContext = context;
			this.incomingMessage = new byte[transportContext
					.getMaximumPacketLength()];
			this.outgoingMessage = new ByteArrayWriter(
					transportContext.getMaximumPacketLength());
			this.client = client;

			// Negotiate the protocol version
			currentState = TransportProtocol.NEGOTIATING_PROTOCOL;

			// Perform key exchange
			sendKeyExchangeInit(false);

			if (Log.isDebugEnabled()) {
				Log.debug(this,
						"Waiting for transport protocol to complete initialization");
			}

			while (processMessage(readMessage()) && currentState != CONNECTED) {
				;
			}
		} catch (IOException ex) {
			throw new SshException(ex, SshException.CONNECT_FAILED);
		}

		if (Log.isDebugEnabled()) {
			Log.debug(this, "Transport protocol initialized");
		}

	}
401367
SamlPortConfigBuilder setSchemeAndPortIfAbsent(ServerPort serverPort) {
        requireNonNull(serverPort, "serverPort");
        if (serverPort.hasHttps()) {
            setSchemeIfAbsent(SessionProtocol.HTTPS);
        } else if (serverPort.hasHttp()) {
            setSchemeIfAbsent(SessionProtocol.HTTP);
        } else {
            throw new IllegalArgumentException("unexpected session protocol: " + serverPort.protocols());
        }

        // Do not set a port if the port number is 0 which means that the port will be automatically chosen.
        final int port = serverPort.localAddress().getPort();
        if (isValidPort(port)) {
            setPortIfAbsent(port);
        }
        return this;
    }
1227333
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.rm.OfflineDataUploadServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.rm.OfflineDataUploadServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.rm.OfflineDataUploadServiceSoapBindingStub(new java.net.URL(OfflineDataUploadServiceInterfacePort_address), this);
                _stub.setPortName(getOfflineDataUploadServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
865659
public Socket connectSocket(
        final Socket sock,
        final String host,
        final int port,
        final InetAddress localAddress,
        int localPort,
        final HttpParams params
    ) throws IOException {

        if (host == null) {
            throw new IllegalArgumentException("Target host may not be null.");
        }
        if (params == null) {
            throw new IllegalArgumentException("Parameters may not be null.");
        }

        SSLSocket sslsock = (SSLSocket)
            ((sock != null) ? sock : createSocket());

        if ((localAddress != null) || (localPort > 0)) {

            // we need to bind explicitly
            if (localPort < 0)
                localPort = 0; // indicates "any"

            InetSocketAddress isa =
                new InetSocketAddress(localAddress, localPort);
            sslsock.bind(isa);
        }

        int connTimeout = HttpConnectionParams.getConnectionTimeout(params);
        int soTimeout = HttpConnectionParams.getSoTimeout(params);

        InetSocketAddress remoteAddress;
        if (this.nameResolver != null) {
            remoteAddress = new InetSocketAddress(this.nameResolver.resolve(host), port); 
        } else {
            remoteAddress = new InetSocketAddress(host, port);            
        }
        
        sslsock.connect(remoteAddress, connTimeout);

        sslsock.setSoTimeout(soTimeout);
        try {
            hostnameVerifier.verify(host, sslsock);
            // verifyHostName() didn't blowup - good!
        } catch (IOException iox) {
            // close the socket before re-throwing the exception
            try { sslsock.close(); } catch (Exception x) { /*ignore*/ }
            throw iox;
        }

        return sslsock;
    }
699398
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.cm.CampaignGroupPerformanceTargetServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.cm.CampaignGroupPerformanceTargetServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.cm.CampaignGroupPerformanceTargetServiceSoapBindingStub(new java.net.URL(CampaignGroupPerformanceTargetServiceInterfacePort_address), this);
                _stub.setPortName(getCampaignGroupPerformanceTargetServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
1155141
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201811.ContentServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201811.ContentServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201811.ContentServiceSoapBindingStub(new java.net.URL(ContentServiceInterfacePort_address), this);
                _stub.setPortName(getContentServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
526066
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.cm.BatchJobServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.cm.BatchJobServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.cm.BatchJobServiceSoapBindingStub(new java.net.URL(BatchJobServiceInterfacePort_address), this);
                _stub.setPortName(getBatchJobServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
451554
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201902.ContactServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201902.ContactServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201902.ContactServiceSoapBindingStub(new java.net.URL(ContactServiceInterfacePort_address), this);
                _stub.setPortName(getContactServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
957094
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.cm.ReportDefinitionServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.cm.ReportDefinitionServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.cm.ReportDefinitionServiceSoapBindingStub(new java.net.URL(ReportDefinitionServiceInterfacePort_address), this);
                _stub.setPortName(getReportDefinitionServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
760999
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201805.ActivityServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201805.ActivityServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201805.ActivityServiceSoapBindingStub(new java.net.URL(ActivityServiceInterfacePort_address), this);
                _stub.setPortName(getActivityServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
1051051
public void setRemotePort(String pRemotePort) {
        try {
            remotePort = Integer.parseInt(pRemotePort);
        }
        catch (NumberFormatException e) {
            log("RemotePort must be a number!", e);
        }
    }
23592
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.cm.CustomerNegativeCriterionServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.cm.CustomerNegativeCriterionServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.cm.CustomerNegativeCriterionServiceSoapBindingStub(new java.net.URL(CustomerNegativeCriterionServiceInterfacePort_address), this);
                _stub.setPortName(getCustomerNegativeCriterionServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
1084478
@Given("^I outbound copy '(.+?)' through a ssh connection to '(.+?)'$")
    public void copyToRemoteFile(String localPath, String remotePath) throws Exception {
        commonspec.getRemoteSSHConnection().copyTo(localPath, remotePath);
    }