// Methods to attempt socket creation /////////////////////////////////////////////////////////////////
+ private Socket getSocket(String host, int port, boolean ssl, boolean negotiate) throws IOException {
+ Socket ret = ssl ? new TinySSL(host, port, negotiate) : new Socket(java.net.InetAddress.getByName(host), port);
+ ret.setTcpNoDelay(true);
+ return ret;
+ }
+
+
/** Attempts a direct connection */
public Socket attemptDirect() {
try {
if (Log.verbose) Log.log(this, "attempting to create unproxied socket to " + host + ":" + port + (ssl ? " [ssl]" : ""));
- return Platform.getSocket(host, port, ssl, true);
+ return getSocket(host, port, ssl, true);
} catch (IOException e) {
if (Log.on) Log.log(this, "exception in attemptDirect(): " + e);
return null;
try {
if (Log.verbose) Log.log(this, "attempting to create HTTP proxied socket using proxy " + proxyHost + ":" + proxyPort);
- Socket sock = Platform.getSocket(proxyHost, proxyPort, ssl, false);
+ Socket sock = getSocket(proxyHost, proxyPort, ssl, false);
if (!ssl) {
if (!path.startsWith("http://")) path = "http://" + host + ":" + port + path;
} else {
" proxied socket using proxy " + proxyHost + ":" + proxyPort);
try {
- Socket sock = Platform.getSocket(proxyHost, proxyPort, ssl, false);
+ Socket sock = getSocket(proxyHost, proxyPort, ssl, false);
DataOutputStream dos = new DataOutputStream(sock.getOutputStream());
dos.writeByte(0x04); // SOCKSv4(a)