FileDocCategorySizeDatePackage
AESocksProxyPlugableConnectionDefault.javaAPI DocAzureus 3.0.3.48340Thu Jan 11 07:45:36 GMT 2007com.aelitis.azureus.core.proxy.socks.impl

AESocksProxyPlugableConnectionDefault

public class AESocksProxyPlugableConnectionDefault extends Object implements AESocksProxyPlugableConnection
author
parg

Fields Summary
protected AESocksProxyConnection
socks_connection
protected com.aelitis.azureus.core.proxy.AEProxyConnection
connection
protected SocketChannel
source_channel
protected SocketChannel
target_channel
protected proxyStateRelayData
relay_data_state
Constructors Summary
public AESocksProxyPlugableConnectionDefault(AESocksProxyConnection _socks_connection)

		socks_connection	= _socks_connection;
		connection			= socks_connection.getConnection();
		
		source_channel	= connection.getSourceChannel();
	
Methods Summary
public voidclose()

		if ( target_channel != null ){
			
			try{
				connection.cancelReadSelect( target_channel );
				connection.cancelWriteSelect( target_channel );
        
				target_channel.close();
				
			}catch( Throwable e ){
				
				Debug.printStackTrace(e);
			}
		}
		
		if ( relay_data_state != null ){
			
			relay_data_state.destroy();
		}
	
public voidconnect(AESocksProxyAddress _address)

		if ( _address.getAddress() == null ){

			throw( new IOException( "DNS lookup of '" + _address.getUnresolvedAddress() + "' fails" ));
		}
		
		new proxyStateRelayConnect( new InetSocketAddress(_address.getAddress(), _address.getPort()));
	
public java.net.InetAddressgetLocalAddress()

		return( target_channel.socket().getInetAddress());
	
public intgetLocalPort()

		return( target_channel.socket().getPort());
	
public java.lang.StringgetName()

		if ( target_channel != null ){
			
			return( target_channel.socket().getInetAddress() + ":" + target_channel.socket().getPort());
		}
		
		return( "" );
	
public voidrelayData()

		new proxyStateRelayData();