My app launches Geth process like this:
geth --cache=512 --rpc
Next it immediately starts to process incoming requests and sends some needed data to http://localhost:8545 (i.e. to geth for the interaction by RPC protocol).
However at the first time after launch (about 5 seconds) geth returns:
Failed to connect to localhost port 8545: Connection refused
Afterwards it works great.
Is such behavior standard?