public static void ensureRouteToHost(Context context,String url,String proxy) throws IOException {
  ConnectivityManager connMgr=(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
  connMgr.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE_HIPRI,"enableMMS");
  if (LOCAL_LOGV)   Log.v(TAG,"ensuring route to host");
  int inetAddr;
  if (proxy != null && !proxy.equals("")) {
    String proxyAddr=proxy;
    inetAddr=lookupHost(proxyAddr);
    if (inetAddr == -1) {
      throw new IOException("Cannot establish route for " + url + ": Unknown host");
    }
 else {
      if (!connMgr.requestRouteToHost(ConnectivityManager.TYPE_MOBILE_MMS,inetAddr)) {
        throw new IOException("Cannot establish route to proxy " + inetAddr);
      }
    }
  }
 else {
    Uri uri=Uri.parse(url);
    inetAddr=lookupHost(uri.getHost());
    if (inetAddr == -1) {
      throw new IOException("Cannot establish route for " + url + ": Unknown host");
    }
 else {
      if (!connMgr.requestRouteToHost(ConnectivityManager.TYPE_MOBILE_MMS,inetAddr)) {
        throw new IOException("Cannot establish route to " + inetAddr + " for "+ url);
      }
    }
  }
}

public static void ensureRouteToHost ( Context context , String url , String proxy ) throws IOException { ConnectivityManager connMgr = ( ConnectivityManager ) context . getSystemService ( Context . CONNECTIVITY_SERVICE ) ; connMgr . startUsingNetworkFeature ( ConnectivityManager . TYPE_MOBILE_HIPRI , "enableMMS" ) ; if ( LOCAL_LOGV ) Log . v ( TAG , "ensuring route to host" ) ; int inetAddr ; if ( proxy != null && ! proxy . equals ( "" ) ) { String proxyAddr = proxy ; inetAddr = lookupHost ( proxyAddr ) ; if ( inetAddr == - 1 ) { throw new IOException ( "Cannot establish route for " + url + ": Unknown host" ) ; } else { if ( ! connMgr . requestRouteToHost ( ConnectivityManager . TYPE_MOBILE_MMS , inetAddr ) ) { throw new IOException ( "Cannot establish route to proxy " + inetAddr ) ; } } } else { Uri uri = Uri . parse ( url ) ; inetAddr = lookupHost ( uri . getHost ( ) ) ; if ( inetAddr == - 1 ) { throw new IOException ( "Cannot establish route for " + url + ": Unknown host" ) ; } else { if ( ! connMgr . requestRouteToHost ( ConnectivityManager . TYPE_MOBILE_MMS , inetAddr ) ) { throw new IOException ( "Cannot establish route to " + inetAddr + " for " + url ) ; } } } }
ensures that the host mmsc is reachable
