Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.sip.net
Class ProxyConnection

java.lang.Object
  extended by net.java.sip.communicator.impl.protocol.sip.net.ProxyConnection
Direct Known Subclasses:
AutoProxyConnection, ManualProxyConnection

public abstract class ProxyConnection
extends Object

Abstract class for the determining the address for the SIP proxy.

Author:
Ingo Bauersachs

Field Summary
protected  SipAccountID account
           
protected  InetSocketAddress socketAddress
           
protected  String transport
           
 
Constructor Summary
protected ProxyConnection(SipAccountID account)
          Creates a new instance of this class.
 
Method Summary
static ProxyConnection create(ProtocolProviderServiceSipImpl pps)
          Factory method to create a proxy connection based on the account settings of the protocol provider.
 InetSocketAddress getAddress()
          Gets the address to use for the next connection attempt.
 boolean getNextAddress()
          Retrieves the next address to use from DNS.
protected abstract  boolean getNextAddressFromDns()
          Implementations must use this method to get the next address, but do not have to care about duplicate addresses.
 String getOutboundProxyString()
          In case we are using an outbound proxy this method returns a suitable string for use with Router.
 String getTransport()
          Gets the transport to use for the next connection attempt.
 boolean isSameInetAddress(InetAddress addressToTest)
          Compares an InetAddress against the active outbound proxy.
 void reset()
          Resets the lookup to it's initial state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transport

protected String transport

socketAddress

protected InetSocketAddress socketAddress

account

protected final SipAccountID account
Constructor Detail

ProxyConnection

protected ProxyConnection(SipAccountID account)
Creates a new instance of this class.

Parameters:
account - the account of this SIP protocol instance
Method Detail

getAddress

public final InetSocketAddress getAddress()
Gets the address to use for the next connection attempt.

Returns:
the address of the last lookup.

getTransport

public final String getTransport()
Gets the transport to use for the next connection attempt.

Returns:
the transport of the last lookup.

getOutboundProxyString

public final String getOutboundProxyString()
In case we are using an outbound proxy this method returns a suitable string for use with Router. The method returns null otherwise.

Returns:
the string of our outbound proxy if we are using one and null otherwise.

isSameInetAddress

public final boolean isSameInetAddress(InetAddress addressToTest)
Compares an InetAddress against the active outbound proxy. The comparison is by reference, not equals.

Parameters:
addressToTest - The addres to test.
Returns:
True when the InetAddress is the same as the outbound proxy.

getNextAddress

public final boolean getNextAddress()
                             throws DnssecException
Retrieves the next address to use from DNS. Duplicate results are suppressed.

Returns:
True if a new address is available through getAddress(), false if the last address was reached. A new lookup from scratch can be started by calling reset().
Throws:
DnssecException - if there is a problem related to DNSSEC

getNextAddressFromDns

protected abstract boolean getNextAddressFromDns()
                                          throws DnssecException
Implementations must use this method to get the next address, but do not have to care about duplicate addresses.

Returns:
True when a further address was available.
Throws:
DnssecException - when a DNSSEC validation failure occured.

reset

public void reset()
Resets the lookup to it's initial state. Overriders methods have to call this method through a super-call.


create

public static ProxyConnection create(ProtocolProviderServiceSipImpl pps)
Factory method to create a proxy connection based on the account settings of the protocol provider.

Parameters:
pps - the protocol provider that needs a SIP server connection.
Returns:
An instance of a derived class.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.