Recent Android version won't allow any network activity on your main/UI thread. You might have a look at AutobahnAndroid - an Android/Java WebSocket implementation that does all networking on background threads.
Disclosure: I am original author of Autobahn and work for Tavendo.