mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 17:49:38 +02:00
[SMACK-226] Added proxy support via patch from Atul Aggarwal.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@10673 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
708284ca46
commit
4c4cc77e42
7 changed files with 1875 additions and 4 deletions
108
source/org/jivesoftware/smack/proxy/DirectSocketFactory.java
Normal file
108
source/org/jivesoftware/smack/proxy/DirectSocketFactory.java
Normal file
|
@ -0,0 +1,108 @@
|
|||
package org.jivesoftware.smack.proxy;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import javax.net.SocketFactory;
|
||||
|
||||
/**
|
||||
* SocketFactory for direct connection
|
||||
*
|
||||
* @author Atul Aggarwal
|
||||
*/
|
||||
class DirectSocketFactory
|
||||
extends SocketFactory
|
||||
{
|
||||
|
||||
public DirectSocketFactory()
|
||||
{
|
||||
}
|
||||
|
||||
public Socket createSocket(String host, int port)
|
||||
throws IOException, UnknownHostException
|
||||
{
|
||||
Socket newSocket = new Socket(Proxy.NO_PROXY);
|
||||
newSocket.connect(new InetSocketAddress(host,port));
|
||||
return newSocket;
|
||||
}
|
||||
|
||||
public Socket createSocket(String host ,int port, InetAddress localHost,
|
||||
int localPort)
|
||||
throws IOException, UnknownHostException
|
||||
{
|
||||
return new Socket(host,port,localHost,localPort);
|
||||
}
|
||||
|
||||
public Socket createSocket(InetAddress host, int port)
|
||||
throws IOException
|
||||
{
|
||||
Socket newSocket = new Socket(Proxy.NO_PROXY);
|
||||
newSocket.connect(new InetSocketAddress(host,port));
|
||||
return newSocket;
|
||||
}
|
||||
|
||||
public Socket createSocket( InetAddress address, int port,
|
||||
InetAddress localAddress, int localPort)
|
||||
throws IOException
|
||||
{
|
||||
return new Socket(address,port,localAddress,localPort);
|
||||
}
|
||||
|
||||
}
|
||||
package org.jivesoftware.smack.proxy;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import javax.net.SocketFactory;
|
||||
|
||||
/**
|
||||
* SocketFactory for direct connection
|
||||
*
|
||||
* @author Atul Aggarwal
|
||||
*/
|
||||
class DirectSocketFactory
|
||||
extends SocketFactory
|
||||
{
|
||||
|
||||
public DirectSocketFactory()
|
||||
{
|
||||
}
|
||||
|
||||
public Socket createSocket(String host, int port)
|
||||
throws IOException, UnknownHostException
|
||||
{
|
||||
Socket newSocket = new Socket(Proxy.NO_PROXY);
|
||||
newSocket.connect(new InetSocketAddress(host,port));
|
||||
return newSocket;
|
||||
}
|
||||
|
||||
public Socket createSocket(String host ,int port, InetAddress localHost,
|
||||
int localPort)
|
||||
throws IOException, UnknownHostException
|
||||
{
|
||||
return new Socket(host,port,localHost,localPort);
|
||||
}
|
||||
|
||||
public Socket createSocket(InetAddress host, int port)
|
||||
throws IOException
|
||||
{
|
||||
Socket newSocket = new Socket(Proxy.NO_PROXY);
|
||||
newSocket.connect(new InetSocketAddress(host,port));
|
||||
return newSocket;
|
||||
}
|
||||
|
||||
public Socket createSocket( InetAddress address, int port,
|
||||
InetAddress localAddress, int localPort)
|
||||
throws IOException
|
||||
{
|
||||
return new Socket(address,port,localAddress,localPort);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue