From the client, I think the initial connection happens on the thread you open the connection. The message processing happens on a separate thread but connect() tries to do the actual socket hookup so that you get host not found errors, etc. right away. (That’s my recollection.)
AsyncTask is only used for things that need the UI thread from what I understand.
You should be able to use standard Java threading classes to do this.
Start a new thread to create the connection then wait for it to exit. Or use an Executor and then shut it down when done.