Change the sequence of configure and agent-connected

This is important to send the agent-connected after the configure. Some clients may send events at agent connection time.