// Path: src/com/oakesville/mythling/util/HttpHelper.java
// public enum AuthType {
//     None,
//     Basic,
//     Digest
// }


import android.net.Uri;
import android.net.http.AndroidHttpClient;
import android.util.Base64;
import android.util.Log;
import com.oakesville.mythling.util.HttpHelper.AuthType;
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.message.BasicHttpRequest;
import org.apache.http.message.BasicHttpResponse;
import org.apache.http.protocol.HttpContext;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.util.StringTokenizer;
/**
 * Copyright 2015 Donald Oakes
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.oakesville.mythling.util;





/**
 * Proxies media streaming requests, providing HTTP Basic and Digest
 * authentication for players that don't natively support these options.
 */
public class MediaStreamProxy implements Runnable {
    private static final String TAG = MediaStreamProxy.class.getSimpleName();

    private InetAddress localhost;
    public InetAddress getLocalhost() { return localhost; }

    private int port;
    public int getPort() { return port; }

    private AndroidHttpClient httpClient;
    private boolean isRunning = true;
    private ServerSocket socket;
    private Thread thread;

    private final ProxyInfo proxyInfo;
// Path: src/com/oakesville/mythling/util/HttpHelper.java
// public enum AuthType {
//     None,
//     Basic,
//     Digest
// }


// Path: src/com/oakesville/mythling/util/MediaStreamProxy.java
import android.net.Uri;
import android.net.http.AndroidHttpClient;
import android.util.Base64;
import android.util.Log;
import com.oakesville.mythling.util.HttpHelper.AuthType;
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.message.BasicHttpRequest;
import org.apache.http.message.BasicHttpResponse;
import org.apache.http.protocol.HttpContext;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.util.StringTokenizer;

/**
 * Copyright 2015 Donald Oakes
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.oakesville.mythling.util;





/**
 * Proxies media streaming requests, providing HTTP Basic and Digest
 * authentication for players that don't natively support these options.
 */
public class MediaStreamProxy implements Runnable {
    private static final String TAG = MediaStreamProxy.class.getSimpleName();

    private InetAddress localhost;
    public InetAddress getLocalhost() { return localhost; }

    private int port;
    public int getPort() { return port; }

    private AndroidHttpClient httpClient;
    private boolean isRunning = true;
    private ServerSocket socket;
    private Thread thread;

    private final ProxyInfo proxyInfo;
    private final AuthType authType;