public class SocksProxy extends Object implements com.aspose.ms.System.IDisposable
SOCKS proxy client. Supported versions of the protocol are SOCKS4 and SOCKS5.
Constructor and Description |
---|
SocksProxy(String address,
int port)
Initializes a new instance of the
SocksProxy class to connect to SOCKS4 server without authentication. |
SocksProxy(String address,
int port,
byte version)
Initializes a new instance of the
SocksProxy class to connect to SOCKS4 or SOCKS5 server without authentication. |
SocksProxy(String address,
int port,
String userID)
Initializes a new instance of the
SocksProxy class to connect to SOCKS4 server without authentication. |
SocksProxy(String address,
int port,
String username,
String password)
Initializes a new instance of the
SocksProxy class to connect to SOCKS5 server with defined username and password. |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes this instance and requests that the underlying TCP connection be closed.
|
String |
getAddress()
The domain name or IP address of the SOCKS server
|
String |
getPassword()
Password for Socks5 authentication (RFC 1929)
|
int |
getPort()
The port number for the SOCKS server
|
com.aspose.ms.System.IO.Stream |
getStream(String address,
int port)
Returns configured network stream to transport data to the required host through the proxy server.
|
byte |
getSupportedAuthenticationMethods()
The supported authentication methods to connect to SOCKS server
|
String |
getUsername()
Username for Socks5 authentication (RFC 1929) or UserID for Socks4 Identification Protocol (RFC 1413)
|
byte |
getVersion()
Required SOCKS server version.
|
void |
setAddress(String value)
The domain name or IP address of the SOCKS server
|
void |
setPassword(String value)
Password for Socks5 authentication (RFC 1929)
|
void |
setPort(int value)
The port number for the SOCKS server
|
void |
setSupportedAuthenticationMethods(byte value)
The supported authentication methods to connect to SOCKS server
|
void |
setUpStream(com.aspose.ms.System.IO.Stream stream,
String address,
int port)
Configures proxy-server to transport data to the target host.
|
void |
setUsername(String value)
Username for Socks5 authentication (RFC 1929) or UserID for Socks4 Identification Protocol (RFC 1413)
|
void |
setVersion(byte value)
Required SOCKS server version.
|
public SocksProxy(String address, int port)
Initializes a new instance of the SocksProxy
class to connect to SOCKS4 server without authentication.
address
- The domain name or IP address of the proxyport
- The port number of the proxypublic SocksProxy(String address, int port, byte version)
Initializes a new instance of the SocksProxy
class to connect to SOCKS4 or SOCKS5 server without authentication.
address
- The domain name or IP address of the proxyport
- The port number of the proxyversion
- Required SOCKS server version.public SocksProxy(String address, int port, String userID)
Initializes a new instance of the SocksProxy
class to connect to SOCKS4 server without authentication.
address
- The domain name or IP address of the proxyport
- The port number of the proxyuserID
- UserID for Socks4 Identification Protocol (RFC 1413)public SocksProxy(String address, int port, String username, String password)
Initializes a new instance of the SocksProxy
class to connect to SOCKS5 server with defined username and password.
address
- The domain name or IP address of the proxyport
- The port number of the proxyusername
- Username for authenticationpassword
- Password for authenticationpublic String getAddress()
The domain name or IP address of the SOCKS server
public void setAddress(String value)
The domain name or IP address of the SOCKS server
public int getPort()
The port number for the SOCKS server
public void setPort(int value)
The port number for the SOCKS server
public String getUsername()
Username for Socks5 authentication (RFC 1929) or UserID for Socks4 Identification Protocol (RFC 1413)
public void setUsername(String value)
Username for Socks5 authentication (RFC 1929) or UserID for Socks4 Identification Protocol (RFC 1413)
public String getPassword()
Password for Socks5 authentication (RFC 1929)
public void setPassword(String value)
Password for Socks5 authentication (RFC 1929)
public byte getVersion()
Required SOCKS server version.
public void setVersion(byte value)
Required SOCKS server version.
public byte getSupportedAuthenticationMethods()
The supported authentication methods to connect to SOCKS server
public void setSupportedAuthenticationMethods(byte value)
The supported authentication methods to connect to SOCKS server
public com.aspose.ms.System.IO.Stream getStream(String address, int port)
Returns configured network stream to transport data to the required host through the proxy server.
address
- The domain name of the host we want to contactport
- The port number of the host we want to contactpublic void setUpStream(com.aspose.ms.System.IO.Stream stream, String address, int port)
Configures proxy-server to transport data to the target host.
stream
- Stream which is connected to the proxy-server.address
- The network address of the target host we want to contactport
- The port number of the target host we want to contactpublic void dispose()
Disposes this instance and requests that the underlying TCP connection be closed.
dispose
in interface com.aspose.ms.System.IDisposable
Copyright (c) 2008-2018 Aspose Pty Ltd. All Rights Reserved.