org.jdiameter.client.impl.transport.tls
Class TLSClientConnection

java.lang.Object
  extended by org.jdiameter.client.impl.transport.tls.TLSClientConnection
All Implemented Interfaces:
Wrapper, IConnection

public class TLSClientConnection
extends java.lang.Object
implements IConnection

Author:
Bartosz Baranowski , Alexandre Mendonca

Constructor Summary
TLSClientConnection(Configuration config, Configuration localPeerSSLConfig, IConcurrentFactory concurrentFactory, java.net.Socket socket, IMessageParser parser)
           
TLSClientConnection(Configuration config, IConcurrentFactory concurrentFactory, java.net.InetAddress remoteAddress, int remotePort, java.net.InetAddress localAddress, int localPort, IConnectionListener listener, IMessageParser parser, java.lang.String ref)
           
TLSClientConnection(Configuration config, IConcurrentFactory concurrentFactory, java.net.InetAddress remoteAddress, int remotePort, java.net.InetAddress localAddress, int localPort, IMessageParser parser, java.lang.String ref)
           
 
Method Summary
 void addConnectionListener(IConnectionListener listener)
          Append connection listener
 void connect()
          Connect with remote host
 void disconnect()
          Disconnect wit remote host
protected  TLSTransportClient getClient()
           
 long getCreatedTime()
          Return created time
 java.lang.String getKey()
          Return identifier of connection.
 java.net.InetAddress getRemoteAddress()
          Return remote host address
 int getRemotePort()
          Return remote socket port
 Configuration getSSLConfig()
           
 javax.net.ssl.SSLSocketFactory getSSLFactory()
           
 boolean isConnected()
          Return true if is connection is valid
 boolean isNetworkInitiated()
          Return true if connection is incomming
 boolean isWrapperFor(java.lang.Class<?> aClass)
           
protected  void onAvpDataException(AvpDataException e)
           
protected  void onConnected()
           
protected  void onDisconnect()
           
protected  void onEvent(org.jdiameter.client.impl.transport.tls.TLSClientConnection.Event event)
           
protected  void onMessageReceived(IMessage message)
           
protected  boolean processBufferedMessages(org.jdiameter.client.impl.transport.tls.TLSClientConnection.Event event)
           
 void release()
          Clear all attachec resources (close socket)
 void remAllConnectionListener()
          Remove all connection listeners
 void remConnectionListener(IConnectionListener listener)
          Remove connection listener
 void sendMessage(IMessage message)
          Send message to remote host
<T> T
unwrap(java.lang.Class<T> aClass)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TLSClientConnection

public TLSClientConnection(Configuration config,
                           IConcurrentFactory concurrentFactory,
                           java.net.InetAddress remoteAddress,
                           int remotePort,
                           java.net.InetAddress localAddress,
                           int localPort,
                           IMessageParser parser,
                           java.lang.String ref)

TLSClientConnection

public TLSClientConnection(Configuration config,
                           IConcurrentFactory concurrentFactory,
                           java.net.InetAddress remoteAddress,
                           int remotePort,
                           java.net.InetAddress localAddress,
                           int localPort,
                           IConnectionListener listener,
                           IMessageParser parser,
                           java.lang.String ref)

TLSClientConnection

public TLSClientConnection(Configuration config,
                           Configuration localPeerSSLConfig,
                           IConcurrentFactory concurrentFactory,
                           java.net.Socket socket,
                           IMessageParser parser)
                    throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getClient

protected TLSTransportClient getClient()

getSSLConfig

public Configuration getSSLConfig()

getSSLFactory

public javax.net.ssl.SSLSocketFactory getSSLFactory()

getCreatedTime

public long getCreatedTime()
Description copied from interface: IConnection
Return created time

Specified by:
getCreatedTime in interface IConnection
Returns:
created time

getRemoteAddress

public java.net.InetAddress getRemoteAddress()
Description copied from interface: IConnection
Return remote host address

Specified by:
getRemoteAddress in interface IConnection
Returns:
remote host address

getRemotePort

public int getRemotePort()
Description copied from interface: IConnection
Return remote socket port

Specified by:
getRemotePort in interface IConnection
Returns:
remote socket port

addConnectionListener

public void addConnectionListener(IConnectionListener listener)
Description copied from interface: IConnection
Append connection listener

Specified by:
addConnectionListener in interface IConnection
Parameters:
listener - listener instance

remAllConnectionListener

public void remAllConnectionListener()
Description copied from interface: IConnection
Remove all connection listeners

Specified by:
remAllConnectionListener in interface IConnection

remConnectionListener

public void remConnectionListener(IConnectionListener listener)
Description copied from interface: IConnection
Remove connection listener

Specified by:
remConnectionListener in interface IConnection
Parameters:
listener - listener instance

release

public void release()
             throws java.io.IOException
Description copied from interface: IConnection
Clear all attachec resources (close socket)

Specified by:
release in interface IConnection
Throws:
java.io.IOException

isWrapperFor

public boolean isWrapperFor(java.lang.Class<?> aClass)
                     throws InternalException
Specified by:
isWrapperFor in interface Wrapper
Throws:
InternalException

unwrap

public <T> T unwrap(java.lang.Class<T> aClass)
         throws InternalException
Specified by:
unwrap in interface Wrapper
Throws:
InternalException

isConnected

public boolean isConnected()
Description copied from interface: IConnection
Return true if is connection is valid

Specified by:
isConnected in interface IConnection
Returns:
true if is connection is valid

isNetworkInitiated

public boolean isNetworkInitiated()
Description copied from interface: IConnection
Return true if connection is incomming

Specified by:
isNetworkInitiated in interface IConnection
Returns:
true if connection is incomming

getKey

public java.lang.String getKey()
Description copied from interface: IConnection
Return identifier of connection. For example: "[remote_host_name]:[remote_port]"

Specified by:
getKey in interface IConnection
Returns:
identifier of connection.

connect

public void connect()
             throws TransportException
Description copied from interface: IConnection
Connect with remote host

Specified by:
connect in interface IConnection
Throws:
TransportException

disconnect

public void disconnect()
                throws java.lang.InternalError
Description copied from interface: IConnection
Disconnect wit remote host

Specified by:
disconnect in interface IConnection
Throws:
java.lang.InternalError

sendMessage

public void sendMessage(IMessage message)
                 throws TransportException,
                        OverloadException
Description copied from interface: IConnection
Send message to remote host

Specified by:
sendMessage in interface IConnection
Parameters:
message - diameter message
Throws:
TransportException
OverloadException

onDisconnect

protected void onDisconnect()
                     throws AvpDataException
Throws:
AvpDataException

onMessageReceived

protected void onMessageReceived(IMessage message)
                          throws AvpDataException
Throws:
AvpDataException

onAvpDataException

protected void onAvpDataException(AvpDataException e)

onConnected

protected void onConnected()

onEvent

protected void onEvent(org.jdiameter.client.impl.transport.tls.TLSClientConnection.Event event)
                throws AvpDataException
Throws:
AvpDataException

processBufferedMessages

protected boolean processBufferedMessages(org.jdiameter.client.impl.transport.tls.TLSClientConnection.Event event)
                                   throws AvpDataException
Throws:
AvpDataException


Copyright © 2014. All Rights Reserved.