Running an SDK Custom Agent in Java, when configuring the serverdef1.timeout to 5, when the Policy Server is down, the init method takes 20 seconds instead of 5 to end.
The serverdef1.timeout is the Request Timeout for a request, not a new connection. The portion of code is to act as HCO of the Agent once a connection is already established. This is what's meant from "agent object" from the documentation (1):
"If you do not already have a default connection and you want a user-defined connection object, you can use the Agent API to create the agent object and then create the new connection, as follows:
Create the agent object.
You can create an agent object based on connection parameters from either of the following sources:
User-defined connection parameters defined in your code for example:
AgentAPI agent = new AgentAPI();
ServerDef sd = new ServerDef();
sd.serverIpAddress = POLICY_IP;
sd.connectionMin = CX_MIN;
sd.connectionMax = CX_MAX;
sd.connectionStep = CX_STEP;
sd.timeout = CX_TIMEOUT;
sd.authorizationPort = AZ_PORT;
sd.authenticationPort = AUTH_PORT;
sd.accountingPort = ACC_PORT;
InitDef init=new InitDef(AGENT_LOGIN,SHARED_SECRET,false, sd);
agent.init(init);"
For the first connection before getting the HCO, then you need to configure the requesttimeout parameter from the SmHost.conf file.