public void setProxy( String host, String port, String user, String pass, String proxyType ) throws KettleJobException { if ( Utils.isEmpty( host ) || Const.toInt( port, 0 ) == 0 ) { throw new KettleJobException( "Proxy server name must be set and server port must be greater than zero." ); } Proxy proxy = null; String proxyhost = host + ":" + port; if ( proxyType.equals( PROXY_TYPE_HTTP ) ) { proxy = new ProxyHTTP( proxyhost ); if ( !Utils.isEmpty( user ) ) { ( (ProxyHTTP) proxy ).setUserPasswd( user, pass ); } } else if ( proxyType.equals( PROXY_TYPE_SOCKS5 ) ) { proxy = new ProxySOCKS5( proxyhost ); if ( !Utils.isEmpty( user ) ) { ( (ProxySOCKS5) proxy ).setUserPasswd( user, pass ); } } s.setProxy( proxy ); }
this.session.setProxy(new ProxyHTTP(proxyHost, proxyPort));
switch (proxyConfig.getProxyType()) { case HTTP: final ProxyHTTP proxyHTTP = new ProxyHTTP(proxyConfig.getProxyServerHost(), proxyConfig.getProxyServerPort()); proxyHTTP.setUserPasswd(proxyConfig.getProxyUserName(), proxyConfig.getProxyUserPassword());
@Override protected Proxy createInstance() throws Exception { switch (this.type) { case SOCKS5: ProxySOCKS5 socks5proxy = new ProxySOCKS5(this.host, this.port); socks5proxy.setUserPasswd(this.user, this.password); return socks5proxy; case SOCKS4: ProxySOCKS4 socks4proxy = new ProxySOCKS4(this.host, this.port); socks4proxy.setUserPasswd(this.user, this.password); return socks4proxy; case HTTP: ProxyHTTP httpProxy = new ProxyHTTP(this.host, this.port); httpProxy.setUserPasswd(this.user, this.password); return httpProxy; default: throw new IllegalArgumentException("Invalid type:" + this.type); } }
public static ProxyHTTP createHTTPProxy(String proxyHost, int proxyPort, String proxyUsername, String proxyPassword){ ProxyConnectionDetails proxyConnectionDetails = new ProxyConnectionDetails(proxyHost, proxyPort, proxyUsername, proxyPassword); ProxyHTTP proxyHTTP = new ProxyHTTP(proxyConnectionDetails.getProxyHost(), proxyConnectionDetails.getProxyPort()); String username = (StringUtilities.isEmpty(proxyUsername) ? null : proxyUsername); String password = (StringUtilities.isEmpty(proxyPassword) ? null : proxyPassword); proxyHTTP.setUserPasswd(username, password); return proxyHTTP; }
@Override protected Proxy createInstance() throws Exception { switch (this.type) { case SOCKS5: ProxySOCKS5 socks5proxy = new ProxySOCKS5(this.host, this.port); socks5proxy.setUserPasswd(this.user, this.password); return socks5proxy; case SOCKS4: ProxySOCKS4 socks4proxy = new ProxySOCKS4(this.host, this.port); socks4proxy.setUserPasswd(this.user, this.password); return socks4proxy; case HTTP: ProxyHTTP httpProxy = new ProxyHTTP(this.host, this.port); httpProxy.setUserPasswd(this.user, this.password); return httpProxy; default: throw new IllegalArgumentException("Invalid type:" + this.type); } }
connectSession.setProxy(new ProxySOCKS5(phost, pport)); } else { connectSession.setProxy(new ProxyHTTP(phost, pport));
public static ProxyHTTP createHTTPProxy(String proxyHost, int proxyPort, String proxyUsername, String proxyPassword){ ProxyConnectionDetails proxyConnectionDetails = new ProxyConnectionDetails(proxyHost, proxyPort, proxyUsername, proxyPassword); ProxyHTTP proxyHTTP = new ProxyHTTP(proxyConnectionDetails.getProxyHost(), proxyConnectionDetails.getProxyPort()); String username = (StringUtilities.isEmpty(proxyUsername) ? null : proxyUsername); String password = (StringUtilities.isEmpty(proxyPassword) ? null : proxyPassword); proxyHTTP.setUserPasswd(username, password); return proxyHTTP; }
if (!StringUtils.isEmpty(proxyHost)) session.setProxy(new ProxyHTTP(proxyHost, StringUtils.toInt(remoteSecureCopyInputs.getProxyPort(), Constants.DEFAULT_PROXY_PORT)));
/** * @see #proxy(Proxy) */ public Builder proxy(ProxyConfig proxyConfig) { Optional<HostAndPort> proxyEndpoint = proxyConfig.getProxy(); if (!proxyEndpoint.isPresent()) return proxy((Proxy) null); Optional<Credentials> creds = proxyConfig.getCredentials(); switch (proxyConfig.getType()) { case HTTP: ProxyHTTP httpProxy = new ProxyHTTP(proxyEndpoint.get().getHostText(), proxyEndpoint.get().getPort()); if (creds.isPresent()) httpProxy.setUserPasswd(creds.get().identity, creds.get().credential); return proxy(httpProxy); case SOCKS: ProxySOCKS5 socksProxy = new ProxySOCKS5(proxyEndpoint.get().getHostText(), proxyEndpoint.get().getPort()); if (creds.isPresent()) socksProxy.setUserPasswd(creds.get().identity, creds.get().credential); return proxy(socksProxy); default: throw new IllegalArgumentException(proxyConfig.getType() + " not supported"); } }
if (!StringUtils.isEmpty(proxyHost)) session.setProxy(new ProxyHTTP(proxyHost, StringUtils.toInt(remoteSecureCopyInputs.getProxyPort(), Constants.DEFAULT_PROXY_PORT)));
/** * @see #proxy(Proxy) */ public Builder proxy(ProxyConfig proxyConfig) { Optional<HostAndPort> proxyEndpoint = proxyConfig.getProxy(); if (!proxyEndpoint.isPresent()) return proxy((Proxy) null); Optional<Credentials> creds = proxyConfig.getCredentials(); switch (proxyConfig.getType()) { case HTTP: ProxyHTTP httpProxy = new ProxyHTTP(proxyEndpoint.get().getHostText(), proxyEndpoint.get().getPort()); if (creds.isPresent()) httpProxy.setUserPasswd(creds.get().identity, creds.get().credential); return proxy(httpProxy); case SOCKS: ProxySOCKS5 socksProxy = new ProxySOCKS5(proxyEndpoint.get().getHostText(), proxyEndpoint.get().getPort()); if (creds.isPresent()) socksProxy.setUserPasswd(creds.get().identity, creds.get().credential); return proxy(socksProxy); default: throw new IllegalArgumentException(proxyConfig.getType() + " not supported"); } }
this.session.setProxy(new ProxyHTTP(proxyHost, proxyPort));
/** * @see #proxy(Proxy) */ public Builder proxy(ProxyConfig proxyConfig) { Optional<HostAndPort> proxyEndpoint = proxyConfig.getProxy(); if (!proxyEndpoint.isPresent()) return proxy((Proxy) null); Optional<Credentials> creds = proxyConfig.getCredentials(); switch (proxyConfig.getType()) { case HTTP: ProxyHTTP httpProxy = new ProxyHTTP(proxyEndpoint.get().getHostText(), proxyEndpoint.get().getPort()); if (creds.isPresent()) httpProxy.setUserPasswd(creds.get().identity, creds.get().credential); return proxy(httpProxy); case SOCKS: ProxySOCKS5 socksProxy = new ProxySOCKS5(proxyEndpoint.get().getHostText(), proxyEndpoint.get().getPort()); if (creds.isPresent()) socksProxy.setUserPasswd(creds.get().identity, creds.get().credential); return proxy(socksProxy); default: throw new IllegalArgumentException(proxyConfig.getType() + " not supported"); } }
ProxyHTTP buildProxy(final JGitFileSystemProviderConfiguration config) { final String host; final int port; String user = null; String passw = null; if (config.isSshOverHttpProxy()) { host = config.getHttpProxyHost(); port = config.getHttpProxyPort(); user = config.getHttpProxyUser(); passw = config.getHttpProxyPassword(); } else { host = config.getHttpsProxyHost(); port = config.getHttpsProxyPort(); user = config.getHttpsProxyUser(); passw = config.getHttpsProxyPassword(); } final ProxyHTTP proxyHTTP = new ProxyHTTP(host, port); if (user != null) { proxyHTTP.setUserPasswd(user, passw); } return proxyHTTP; } }