title: best performance way to stream with using http-client through the proxy network
body: <p>I am using a network with proxy authentication that require username/password for authentication. I want to stream a music, and i know that <code>MediaPlayer</code> only can stream from a direct network. Now, i want to use <code>HttpClient</code> or other network classes to download the media and play it locally in download time, I know about downloading with using <code>HttpClient</code> through the proxy network :</p>
  
  <pre><code>String M_url = "http://printf.ir/music/01.wma";
  
  DefaultHttpClient request = new DefaultHttpClient();
  request.getCredentialsProvider().setCredentials(
      AuthScope.ANY,
      new NTCredentials(proxyUser, proxyPassword,
                proxyAddress, proxyDomain));
  HttpHost p = new HttpHost(proxyAddress, proxyPort);
  request.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,p);
  
  URL url = new URL(M_url);
  HttpGet httpGet = new HttpGet(new URI(url.getProtocol(), url.getHost(),
                url.getPath(), url.getQuery(), null));
  
  byte[] buffer = new byte[5 * 1024];
  int readBytes = 0;
  
  InputStream in = request.execute(httpGet).getEntity().getContent();
  
  while ( (readBytes = in.read(buffer, 0, 1024)) != -1){
       //buffer is completed
  }
  </code></pre>
  
  <p>How can i link buffer bytes to <code>MediaPlayer</code> object and play media successfully? Please give me a best performance solution.</p>
  
  <p>Thanks for your advance :)</p>