I have the following code running in AsyncTask:
socket = new Socket(host, Integer.parseInt(port));
Create the socket with the no parameters contructor like this:
socket = new Socket();
See http://developer.android.com/reference/java/net/Socket.html for more information.
-- Update --
I didn't notice originally that you asked about how to cancel the socket connection. While I'm not real familiar with socket programming it looks like you would do this: