com.enterprisedt.util.proxy
Class ProxyServerSocket

java.lang.Object
  extended by com.enterprisedt.util.proxy.ProxyServerSocket
Direct Known Subclasses:
SSLProxyServerSocket

public class ProxyServerSocket
extends java.lang.Object

Supports no proxy or SOCKS proxies. HTTP proxies not supported (as they can't do active mode).

Version:
$Revision: 1.2 $
Author:
Bruce Blackshaw

Field Summary
protected  java.net.InetAddress localAddress
           
protected  ProxySettings proxySettings
           
protected  int receivesize
           
protected  int sendsize
           
protected  StreamServerSocket serverSocket
           
protected  SocksProxySocket socksSocket
           
protected  int timeout
           
 
Constructor Summary
ProxyServerSocket(ProxySettings proxySettings)
           
 
Method Summary
 StreamSocket acceptConnection()
          Accept a connection
 void bind(int port, java.net.InetAddress addr)
          Bind server socket to a port to listen on
 void close()
          Close the socket
 java.net.InetAddress getLocalAddress()
           
 int getLocalPort()
           
 int getReceiveBufferSize()
          Gets the value of SO_RCVBUF
 int getSendBufferSize()
          Get value of the SO_SNDBUF option
protected  StreamServerSocket getServerSocket()
           
 int getSoTimeout()
          Returns setting for SO_TIMEOUT.
 void setLocalAddress(java.net.InetAddress addr)
           
 void setReceiveBufferSize(int size)
          Sets the SO_RCVBUF option
 void setSendBufferSize(int size)
          Sets the SO_SNDBUF option
 void setSoTimeout(int timeout)
          Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

proxySettings

protected ProxySettings proxySettings

serverSocket

protected StreamServerSocket serverSocket

socksSocket

protected SocksProxySocket socksSocket

localAddress

protected java.net.InetAddress localAddress

timeout

protected int timeout

receivesize

protected int receivesize

sendsize

protected int sendsize
Constructor Detail

ProxyServerSocket

public ProxyServerSocket(ProxySettings proxySettings)
Method Detail

getLocalPort

public int getLocalPort()

getLocalAddress

public java.net.InetAddress getLocalAddress()
                                     throws java.io.IOException
Throws:
java.io.IOException

setLocalAddress

public void setLocalAddress(java.net.InetAddress addr)

setSoTimeout

public void setSoTimeout(int timeout)
                  throws java.io.IOException
Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.

Parameters:
timeout -
Throws:
java.net.SocketException
java.io.IOException

getSoTimeout

public int getSoTimeout()
                 throws java.io.IOException
Returns setting for SO_TIMEOUT.

Throws:
java.io.IOException

getReceiveBufferSize

public int getReceiveBufferSize()
                         throws java.net.SocketException
Gets the value of SO_RCVBUF

Throws:
java.net.SocketException

setReceiveBufferSize

public void setReceiveBufferSize(int size)
                          throws java.net.SocketException
Sets the SO_RCVBUF option

Throws:
java.net.SocketException

setSendBufferSize

public void setSendBufferSize(int size)
                       throws java.net.SocketException
Sets the SO_SNDBUF option

Throws:
java.net.SocketException

getSendBufferSize

public int getSendBufferSize()
                      throws java.net.SocketException
Get value of the SO_SNDBUF option

Throws:
java.net.SocketException

bind

public void bind(int port,
                 java.net.InetAddress addr)
          throws java.io.IOException
Bind server socket to a port to listen on

Parameters:
port -
addr -
Throws:
java.io.IOException

getServerSocket

protected StreamServerSocket getServerSocket()
                                      throws java.io.IOException
Throws:
java.io.IOException

acceptConnection

public StreamSocket acceptConnection()
                              throws java.io.IOException
Accept a connection

Returns:
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Close the socket

Throws:
java.io.IOException


Copyright © 2001-2009 Enterprise Distributed Technologies Ltd. All Rights Reserved.