|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ocap.test.OCAPTest
public class OCAPTest
The purpose of this class is to provide a very simple communication
channel between the OCAP implementation under test (IUT) and the test server.
The functionality of this class is intentionally limited to
sending/receiving raw messages via TCP/IP or UDP/IP protocol.
This approach decouples the lower
communications channel from the higher messaging protocol used to exchange messages
between the test client and the test server. As a result, the implementation will
be isolated from any future messaging protocol changes which may be required
for future testing needs.
This class does not provide a means for concurrently executing test applications
to negotiate reservation of the interaction channel used to exchange message with
the test environment host. Test application authors should ensure that
concurrently executing test applications correctly interoperate in their use of
this channel.
The implementation of this class MUST use TCP/IP or UDP/IP protocol to establish a
socket connection to the test server via the RF connector labeled 'Cable In'
on the OCAP Host Device. See the getProtocol()
method.
Field Summary | |
---|---|
static int |
MAX_MESSAGE_LENGTH
Maximum length of messages exchanged between ATE and a test application. |
static byte |
MESSAGE_TERMINATION_BYTE
Message termination byte. |
static int |
TCP
Indicates that an OCAPTest instance is configured to use TCP/IP protocol. |
static int |
UDP
Indicates that an OCAPTest instance is configured to use UDP/IP protocol. |
Constructor Summary | |
---|---|
OCAPTest()
|
Method Summary | |
---|---|
static int |
getProtocol()
Returns a current protocol that is used by an OCAPTest instance. |
static byte[] |
receive()
Receive a byte array from ATE via TCP/IP. |
static byte[] |
receiveUDP()
Receive a message from ATE via UDP/IP. |
static void |
send(byte[] rawMessage)
Send a specified byte array to ATE via TCP/IP protocol. |
static void |
sendUDP(byte[] rawMessage)
Send rawMessage to ATE via UDP/IP. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte MESSAGE_TERMINATION_BYTE
send(byte[])
and receive()
methods the
specified rawMessage and the returned bytes shall not contain
MESSAGE_TERMINATION_BYTE except indicating message termination.
For the sendUDP(byte[])
and receiveUDP()
methods
the specified rawMessage and the returned bytes may contain
MESSAGE_TERMINATION_BYTE to process acknowledge protocol.
public static final int MAX_MESSAGE_LENGTH
public static final int UDP
public static final int TCP
Constructor Detail |
---|
public OCAPTest()
Method Detail |
---|
public static void send(byte[] rawMessage) throws java.io.IOException
MESSAGE_TERMINATION_BYTE
will be sent by this method, indicating to
the ATE that the rawMessage is complete,
and ready for parsing.
rawMessage
- a byte array of the raw message to be sent to
ATE via TCP/IP protocol.
java.lang.IllegalArgumentException
- If rawMessage contains a byte with the
value MESSAGE_TERMINATION_BYTE.
java.io.IOException
- If there is any problem with I/O operations or an
interaction channel has not been initialized.public static byte[] receive() throws java.io.IOException
MESSAGE_TERMINATION_BYTE
is received. The all received bytes
MUST then be returned to the caller as a byte[]
. The
termination character is not to be included in the returned byte array.
There should be no other assumptions as to the format or content of the
message bytes.
MAX_MESSAGE_LENGTH
.
Any bytes received beyond MAX_MESSAGE_LENGTH should be discarded. In any
event, this method must not return until a
MESSAGE_TERMINATION_BYTE
has been encountered.
java.io.IOException
- If there is any problem with I/O operations or an
interaction channel has not been initialized.public static int getProtocol()
UDP
or TCP
constant.public static byte[] receiveUDP() throws java.io.IOException
java.io.IOException
- If there is any problem with I/O operations or an
interaction channel has not been initialized.public static void sendUDP(byte[] rawMessage) throws java.io.IOException
rawMessage
- byte data to be sent. The byte length must be
less than a max length limited by the interaction channel and
it is responsibility of a caller of this method to do so.
java.io.IOException
- If there is any problem with I/O operations or an
interaction channel has not been initialized.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |