forked from External/mage
added client proxy settings + other fixes
This commit is contained in:
parent
ddeb0de911
commit
1fef6e6bb4
7 changed files with 263 additions and 60 deletions
|
|
@ -86,17 +86,29 @@ public class Session {
|
|||
public Session(MageFrame frame) {
|
||||
this.frame = frame;
|
||||
}
|
||||
|
||||
public boolean connect(String userName, String serverName, int port) {
|
||||
return connect(userName, serverName, port, "", 0);
|
||||
}
|
||||
|
||||
public boolean connect(String userName, String serverName, int port, String proxyServer, int proxyPort) {
|
||||
if (isConnected()) {
|
||||
disconnect();
|
||||
}
|
||||
try {
|
||||
System.setSecurityManager(null);
|
||||
if (proxyServer.length() > 0) {
|
||||
System.setProperty("socksProxyHost", proxyServer);
|
||||
System.setProperty("socksProxyPort", Integer.toString(proxyPort));
|
||||
}
|
||||
else {
|
||||
System.clearProperty("socksProxyHost");
|
||||
System.clearProperty("socksProxyPort");
|
||||
}
|
||||
Registry reg = LocateRegistry.getRegistry(serverName, port);
|
||||
this.server = (Server) reg.lookup(Config.remoteServer);
|
||||
this.userName = userName;
|
||||
this.client = new Client(this, frame, userName);
|
||||
if (client == null)
|
||||
client = new Client(this, frame);
|
||||
sessionId = server.registerClient(userName, client.getId(), frame.getVersion());
|
||||
callbackDaemon = new CallbackClientDaemon(sessionId, client, server);
|
||||
serverState = server.getServerState();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue