try { InputStream is = new AsyncInputStream(data.getInputStream()); OutputStream os = data.getOutputStream(); // Process the data socket here } catch (Exception e) {}