Source:
public void testLocalFileDownload ( ) throws com.android.sdklib.internal.repository.CanceledByUserException , java.io.IOException { com.android.sdkmanager.Main main = new com.android.sdkmanager.Main ( ) ; main.setLogger ( getLog ( ) ) ; com.android.sdklib.SdkManager sdkman = getSdkManager ( ) ; main.setSdkManager ( sdkman ) ; getLog ( ) . clear ( ) ; com.android.sdklib.IAndroidTarget target = sdkman.getTargets ( ) [ 0 ] ; java.io.File sourceProps = new java.io.File ( target.getLocation ( ) , com.android.SdkConstants.FN_SOURCE_PROP ) ; assertTrue ( sourceProps.isFile ( ) ) ; java.lang.String urlStr = getFileUrl ( sourceProps ) ; assertTrue ( urlStr.startsWith ( "file:///" ) ) ; com.android.sdklib.internal.repository.DownloadCache cache = new com.android.sdklib.internal.repository.DownloadCache ( com.android.sdklib.internal.repository.DownloadCache.Strategy.DIRECT ) ; com.android.sdklib.internal.repository.NullTaskMonitor monitor = new com.android.sdklib.internal.repository.NullTaskMonitor ( getLog ( ) ) ; com.android.utils.Pair < java.io.InputStream , java.lang.Integer > result = cache.openDirectUrl ( urlStr , monitor ) ; assertNotNull ( result ) ; assertEquals ( 200 , result.getSecond ( ) . intValue ( ) ) ; int len = ( ( int ) ( sourceProps.length ( ) ) ) ; byte [ ] buf = new byte [ len ] ; java.io.FileInputStream is = new java.io.FileInputStream ( sourceProps ) ; is.read ( buf ) ; is.close ( ) ; java.lang.String expected = new java.lang.String ( buf , "UTF-8" ) ; buf = new byte [ len ] ; result.getFirst ( ) . read ( buf ) ; result.getFirst ( ) . close ( ) ; java.lang.String actual = new java.lang.String ( buf , "UTF-8" ) ; assertEquals ( expected , actual ) ; }

Target:
public void testLocalFileDownload ( ) throws com.android.sdklib.internal.repository.CanceledByUserException , java.io.IOException { com.android.sdkmanager.Main main = new com.android.sdkmanager.Main ( ) ; com.android.sdklib.SdkManager sdkman = getSdkManager ( ) ; main.setupForTest ( getSdkManager ( ) , getLog ( ) , null ) ; getLog ( ) . clear ( ) ; com.android.sdklib.IAndroidTarget target = sdkman.getTargets ( ) [ 0 ] ; java.io.File sourceProps = new java.io.File ( target.getLocation ( ) , com.android.SdkConstants.FN_SOURCE_PROP ) ; assertTrue ( sourceProps.isFile ( ) ) ; java.lang.String urlStr = getFileUrl ( sourceProps ) ; assertTrue ( urlStr.startsWith ( "file:///" ) ) ; com.android.sdklib.internal.repository.DownloadCache cache = new com.android.sdklib.internal.repository.DownloadCache ( com.android.sdklib.internal.repository.DownloadCache.Strategy.DIRECT ) ; com.android.sdklib.internal.repository.NullTaskMonitor monitor = new com.android.sdklib.internal.repository.NullTaskMonitor ( getLog ( ) ) ; com.android.utils.Pair < java.io.InputStream , java.lang.Integer > result = cache.openDirectUrl ( urlStr , monitor ) ; assertNotNull ( result ) ; assertEquals ( 200 , result.getSecond ( ) . intValue ( ) ) ; int len = ( ( int ) ( sourceProps.length ( ) ) ) ; byte [ ] buf = new byte [ len ] ; java.io.FileInputStream is = new java.io.FileInputStream ( sourceProps ) ; is.read ( buf ) ; is.close ( ) ; java.lang.String expected = new java.lang.String ( buf , "UTF-8" ) ; buf = new byte [ len ] ; result.getFirst ( ) . read ( buf ) ; result.getFirst ( ) . close ( ) ; java.lang.String actual = new java.lang.String ( buf , "UTF-8" ) ; assertEquals ( expected , actual ) ; }