* Expectation: passes
*/
@Test
public void t01_ConnectSendAndDisconnect50000() throws Exception {
ConnectionFactory connectionFactory = AppContext.getConnectionFactory();
IConnection connection = connectionFactory.createConnection(ConnectionType.NETTY_HTTP.getValue());
connection.setHost(TestConstants.HOST);
connection.setPort(TestConstants.PORT_SC0_HTTP);
connection.setIdleTimeoutSeconds(0); // idle timeout inactive
IIdleConnectionCallback idleCallback = new IdleCallback();
ConnectionContext connectionContext = new ConnectionContext(connection, idleCallback, 0);
connection.setContext(connectionContext);
String ldt = DateTimeUtility.getCurrentTimeZoneMillis();
SCMPMessage message = new SCMPMessage(SCMPVersion.CURRENT);
message.setMessageType(SCMPMsgType.ATTACH);
message.setHeader(SCMPHeaderAttributeKey.SC_VERSION, SCVersion.CURRENT.toString());
message.setHeader(SCMPHeaderAttributeKey.LOCAL_DATE_TIME, ldt);
for (int i = 0; i < 50000; i++) {
connection.connect();
TestCallback cbk = new TestCallback();
connection.send(message, cbk);
TestUtil.checkReply(cbk.getMessageSync(3000));
connection.disconnect();
if ((i + 1) % 1000 == 0) {
testLogger.info("connection nr " + (i + 1) + "...");
}
}
}