|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mobicents.protocols.smpp.net.AbstractStreamLink
org.mobicents.protocols.smpp.net.ObjectLink
public class ObjectLink
Link implementation which returns packets which have previously been added to
it. This implementation is useful for testing applications by first setting
up the link by adding packets to it which is will later return when used by a
Connection object. For example:
ObjectLink ol = new ObjectLink(); // Naturally, better test code will set up the packet fields before using // them. ol.add(new BindReceiverResp()); ol.add(new DeliverSM()); ol.add(new DeliverSM()); ol.add(new DeliverSM()); Connection conn = new Connection(ol); conn.bind(id, pass, type);This class will always return the packets in the order they are added. If the next packet in line is a response packet, it will wait until a request has been sent before reporting a packet is available to the
Connection. If it is a request packet, it will be made
available immediately to the Connection.
| Constructor Summary | |
|---|---|
ObjectLink()
Create a new empty ObjectLink. |
|
| Method Summary | |
|---|---|
void |
add(SMPPPacket pak)
|
void |
addDelay(long milliseconds)
Add a millisecond delay to the stream. |
void |
connect()
Initiate the connection to the SMSC. |
void |
disconnect()
Close the connection to the SMSC. |
protected InputStream |
getInputStream()
|
protected OutputStream |
getOutputStream()
|
int |
getTimeout()
Get the current timeout for the underlying link. |
boolean |
isConnected()
Determine if the underlying link is connected to the SMSC. |
boolean |
isTimeoutSupported()
Determine if this SMSC link supports read timeouts. |
byte[] |
read(byte[] buf)
|
void |
setTimeout(int timeout)
Set the read timeout for the underlying link. |
void |
write(SMPPPacket pak,
boolean withOptional)
Send a packet to the SMSC. |
| Methods inherited from class org.mobicents.protocols.smpp.net.AbstractStreamLink |
|---|
available, flush, getAutoFlush, read, setAutoFlush, setInputStream, setOutputStream, setSnoopStreams |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ObjectLink()
| Method Detail |
|---|
public boolean isConnected()
SmscLink
true if connected, false otherwise.public boolean isTimeoutSupported()
SmscLink
true if the implementation supports read timeouts,
false if not.public int getTimeout()
SmscLinkUnsupportedOperationException.
SmscLink.setTimeout(int)public void setTimeout(int timeout)
SmscLinktimeout, then a
ReadTimeoutException should be thrown. Supporting read timeouts
is optional for SmscLink implementations. If it is not supported,
calls to this method must throw an
UnsupportedOperationException. A timeout value
of 0 deactivates timeouts - reads will block forever.
timeout - The new timeout value, specified in milliseconds.
public void write(SMPPPacket pak,
boolean withOptional)
throws IOException
AbstractStreamLink
write in interface SmscLinkwrite in class AbstractStreamLinkpak - the SMPP packet to send.withOptional - true to send the optional parameters over the link too, false
to only send the mandatory parameters.
IOException
public byte[] read(byte[] buf)
throws IOException
IOExceptionpublic void add(SMPPPacket pak)
public void addDelay(long milliseconds)
read method is called.
milliseconds - Number of milliseconds to delay. Values less than 1 will be
ignored.
public void connect()
throws IOException
SmscLink
IOException
public void disconnect()
throws IOException
AbstractStreamLinkSession.unbind()) before
closing the underlying network link. The connection may be reestablished
using #open.
disconnect in interface SmscLinkdisconnect in class AbstractStreamLinkIOException
protected OutputStream getOutputStream()
throws IOException
IOException
protected InputStream getInputStream()
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||