Using TCP and UDP transports
Depending on the version of HCL OneTest™ API that you are using, there are different options available when creating operations, tests, and stubs that use TCP and UDP transports.
Creating and closing TCP connections
If you are using HCL OneTest™ API 8.6.0 or later, you can control how creates and closes connections when using TCP transports for testing.
In
the Architecture School perspective:
- To create or modify an operation that makes use of a TCP transport,
two options are available in the Logical View:
- Select the Create new connection before publishing check box under Binding in Message Exchange Pattern in the Operation window if you want to specify that HCL OneTest™ API must drop an existing connection and reconnect before publishing a message.
- Clear the Create new connection before publishing check box if you want HCL OneTest™ API to attempt to reuse an existing connection before publishing.
- To generate a message with an empty body and a
messageType
of100
in the header when a connection is accepted:- In Physical View, in the TCP Server window, click the Server tab.
- Select the Generate message on connection check box.
messageType
file:If the Generate message on connection check box is selected, only a stub will receive an empty message with aTable 1. messageType file values messageType Value New connection 100 Data 200 messageType
of100
when a new connection is made. This can be used in a filter in a stub by expanding Request Header in the Input tab in the Stub Editor window of the Test Factory perspective.
In the Test Factory perspective, when using the Publish window
to create or modify a publish messaging action that uses a TCP transport:
- If you are using a version earlier than 8.6.0:
- Select the Create new connection before publishing check box if you want HCL OneTest™ API to drop an existing connection and reconnect before publishing a message.
- Alternatively, clear the Create new connection before publishing check box if you want HCL OneTest™ API to attempt to reuse an existing connection before publishing.
- In 8.6.0 or later, the following conditions apply when using TCP
transports:
- Connections are created as needed.
- Within a test sequence, the same connection will be used until it is closed.
- When a connection is closed, a new connection is created.
Note: These conditions do no apply to stubs because stub accept connections but do not initiate them.