org.jdiameter.client.impl.transport.sctp
Class SCTPClientConnection

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

public class SCTPClientConnection
extends java.lang.Object
implements IConnection

Author:
Alexandre Mendonca , Bartosz Baranowski

Constructor Summary
  SCTPClientConnection(Configuration config, IConcurrentFactory concurrentFactory, java.net.InetAddress remoteAddress, int remotePort, java.net.InetAddress localAddress, int localPort, IConnectionListener listener, IMessageParser parser, java.lang.String ref)
           
  SCTPClientConnection(Configuration config, IConcurrentFactory concurrentFactory, java.net.InetAddress remoteAddress, int remotePort, java.net.InetAddress localAddress, int localPort, IMessageParser parser, java.lang.String ref)
           
protected SCTPClientConnection(IMessageParser parser)
           
 
Method Summary
 void addConnectionListener(IConnectionListener listener)
          Append connection listener
 void connect()
          Connect with remote host
 void disconnect()
          Disconnect wit remote host
protected  SCTPTransportClient 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
 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.sctp.SCTPClientConnection.Event event)
           
protected  void onMessageReceived(java.nio.ByteBuffer message)
           
protected  boolean processBufferedMessages(org.jdiameter.client.impl.transport.sctp.SCTPClientConnection.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

SCTPClientConnection

protected SCTPClientConnection(IMessageParser parser)

SCTPClientConnection

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

SCTPClientConnection

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

getCreatedTime

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

Specified by:
getCreatedTime in interface IConnection
Returns:
created time

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

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

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

getClient

protected SCTPTransportClient getClient()

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

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

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

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

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.

onDisconnect

protected void onDisconnect()
                     throws AvpDataException
Throws:
AvpDataException

onMessageReceived

protected void onMessageReceived(java.nio.ByteBuffer message)
                          throws AvpDataException
Throws:
AvpDataException

onAvpDataException

protected void onAvpDataException(AvpDataException e)

onConnected

protected void onConnected()

onEvent

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

processBufferedMessages

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


Copyright © 2014. All Rights Reserved.