Package com.bea.wcp.diameter
Class Peer
java.lang.Object
com.bea.wcp.diameter.Peer
Diameter peer implementation based on state machine pattern.
- Author:
- Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates new Peer for an incoming dynamic peer connection.Peer(Node node, String host, InetAddress addr, int port) Peer(Node node, String host, InetAddress addr, int port, String protocol) Peer(Node node, String host, InetAddress addr, int port, String protocol, boolean watchdogEnabled) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidvoiddisconnect(com.bea.wcp.diameter.transport.Connection c) voidelect()voidForward request or answer using relay application.getHost()getNode()intgetPort()Retrieves the protocol to be used for communication with this peer.getRealm()getState()voidiAccept(com.bea.wcp.diameter.transport.Connection c) voidiDisc()voidbooleanisClosed()booleanisOpen()booleanbooleanisTrying()Check the peer current state whether it is connected or trying to connect.voidprocessCEA(Peer.CEA cea) booleanprocessCER(Peer.CER cer) voidrAccept(com.bea.wcp.diameter.transport.Connection c) voidrDisc()voidcom.bea.wcp.diameter.TransactionremoveTransaction(int hopByHopId) voidvoidsndCEA()voidvoidsndCER()voidsndDWR()Sends Device-Watchdog-Request see RFC 3539voidsndRequest(ByteBuffer reqBytes, com.bea.wcp.diameter.Transaction txn) voidstart()voidstop()toString()booleanwaitForClosed(long timeout) booleanwaitForOpen(long timeout) voidCalled when watchdog timeout tick has expired for this peer.
-
Field Details
-
DEFAULT_PORT
public static final int DEFAULT_PORT- See Also:
-
-
Constructor Details
-
Peer
-
Peer
-
Peer
-
Peer
public Peer(Node node, String host, InetAddress addr, int port, String protocol, boolean watchdogEnabled) -
Peer
Creates new Peer for an incoming dynamic peer connection. In this case, we will not automatically try to connect to the peer ourselves.
-
-
Method Details
-
start
public void start() -
initWatchDog
public void initWatchDog() -
sndRequest
public void sndRequest(ByteBuffer reqBytes, com.bea.wcp.diameter.Transaction txn) throws IOException - Throws:
IOException
-
removeTransaction
public com.bea.wcp.diameter.Transaction removeTransaction(int hopByHopId) -
receive
- Throws:
IOException
-
disconnect
- Throws:
IOException
-
connCER
- Throws:
IOException
-
stop
- Throws:
IOException
-
isStopped
public boolean isStopped() -
waitForOpen
public boolean waitForOpen(long timeout) -
waitForClosed
public boolean waitForClosed(long timeout) -
forward
Forward request or answer using relay application. -
isOpen
public boolean isOpen() -
isClosed
public boolean isClosed() -
isTrying
public boolean isTrying()Check the peer current state whether it is connected or trying to connect. returns true if peer is not connected or trying to connect. -
iAccept
public void iAccept(com.bea.wcp.diameter.transport.Connection c) -
rAccept
public void rAccept(com.bea.wcp.diameter.transport.Connection c) -
processCER
-
sndCEA
- Throws:
IOException
-
sndCEA
- Throws:
IOException
-
iDisc
public void iDisc() -
rDisc
public void rDisc() -
processCEA
-
elect
- Throws:
IOException
-
sndCER
- Throws:
IOException
-
close
public void close() -
setState
-
getState
-
getSocketAddressList
-
getSocketAddress
-
getHost
-
getRealm
-
getPort
public int getPort() -
getNode
-
toString
-
watchdogTick
public void watchdogTick()Called when watchdog timeout tick has expired for this peer. -
sndDWR
Sends Device-Watchdog-Request see RFC 3539- Throws:
IOException
-
getProtocol
Retrieves the protocol to be used for communication with this peer.- Returns:
- the protocol to use for communication with this Peer
-