// Path: src/kml/proxy/matchers/CapeMatcher.java
// public class CapeMatcher implements URLMatcher {
//     private final Pattern capeRegex = Pattern.compile("http://skins.minecraft.net/MinecraftCloaks/(.+)\\.png");
// 
//     @Override
//     public final boolean match(String url) {
//         Matcher m = capeRegex.matcher(url);
//         return m.matches();
//     }
// 
//     @Override
//     public final String handle(String url) {
//         Matcher m = capeRegex.matcher(url);
//         if (m.matches()) {
//             String name = m.group(1);
//             return "https://mc.krothium.com/capes/" + name + ".png";
//         }
//         return null;
//     }
// }
// 
// Path: src/kml/proxy/matchers/JoinServerMatcher.java
// public class JoinServerMatcher implements URLMatcher {
//     private final String JOIN_URL = "http://session.minecraft.net/game/joinserver.jsp";
// 
//     @Override
//     public final boolean match(String url) {
//         return url.contains(JOIN_URL) && url.split("\\?").length == 2;
//     }
// 
//     @Override
//     public final String handle(String url) {
//         String[] segments = url.split("\\?");
//         if (url.contains(JOIN_URL) && segments.length == 2) {
//             return "https://mc.krothium.com/server/joinserver?" + segments[1];
//         }
//         return null;
//     }
// }
// 
// Path: src/kml/proxy/matchers/SkinMatcher.java
// public class SkinMatcher implements URLMatcher {
//     private final Pattern skinRegex = Pattern.compile("http://skins.minecraft.net/MinecraftSkins/(.+)\\.png");
// 
//     @Override
//     public final boolean match(String url) {
//         Matcher m = skinRegex.matcher(url);
//         return m.matches();
//     }
// 
//     @Override
//     public final String handle(String url) {
//         Matcher m = skinRegex.matcher(url);
//         if (m.matches()) {
//             String name = m.group(1);
//             return "https://mc.krothium.com/skins/" + name + ".png";
//         }
//         return null;
//     }
// }
// 
// Path: src/kml/proxy/matchers/URLMatcher.java
// public interface URLMatcher {
//     boolean match(String url);
// 
//     String handle(String url);
// }


import kml.proxy.matchers.CapeMatcher;
import kml.proxy.matchers.JoinServerMatcher;
import kml.proxy.matchers.SkinMatcher;
import kml.proxy.matchers.URLMatcher;
import sun.net.www.protocol.http.Handler;
import java.io.IOException;
import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;
package kml.proxy;



/**
 * @author DarkLBP
 *         website https://krothium.com
 */
class HttpHandler extends Handler{

    private final URLMatcher[] urlMatchers;

    public HttpHandler() {
// Path: src/kml/proxy/matchers/CapeMatcher.java
// public class CapeMatcher implements URLMatcher {
//     private final Pattern capeRegex = Pattern.compile("http://skins.minecraft.net/MinecraftCloaks/(.+)\\.png");
// 
//     @Override
//     public final boolean match(String url) {
//         Matcher m = capeRegex.matcher(url);
//         return m.matches();
//     }
// 
//     @Override
//     public final String handle(String url) {
//         Matcher m = capeRegex.matcher(url);
//         if (m.matches()) {
//             String name = m.group(1);
//             return "https://mc.krothium.com/capes/" + name + ".png";
//         }
//         return null;
//     }
// }
// 
// Path: src/kml/proxy/matchers/JoinServerMatcher.java
// public class JoinServerMatcher implements URLMatcher {
//     private final String JOIN_URL = "http://session.minecraft.net/game/joinserver.jsp";
// 
//     @Override
//     public final boolean match(String url) {
//         return url.contains(JOIN_URL) && url.split("\\?").length == 2;
//     }
// 
//     @Override
//     public final String handle(String url) {
//         String[] segments = url.split("\\?");
//         if (url.contains(JOIN_URL) && segments.length == 2) {
//             return "https://mc.krothium.com/server/joinserver?" + segments[1];
//         }
//         return null;
//     }
// }
// 
// Path: src/kml/proxy/matchers/SkinMatcher.java
// public class SkinMatcher implements URLMatcher {
//     private final Pattern skinRegex = Pattern.compile("http://skins.minecraft.net/MinecraftSkins/(.+)\\.png");
// 
//     @Override
//     public final boolean match(String url) {
//         Matcher m = skinRegex.matcher(url);
//         return m.matches();
//     }
// 
//     @Override
//     public final String handle(String url) {
//         Matcher m = skinRegex.matcher(url);
//         if (m.matches()) {
//             String name = m.group(1);
//             return "https://mc.krothium.com/skins/" + name + ".png";
//         }
//         return null;
//     }
// }
// 
// Path: src/kml/proxy/matchers/URLMatcher.java
// public interface URLMatcher {
//     boolean match(String url);
// 
//     String handle(String url);
// }


// Path: src/kml/proxy/HttpHandler.java
import kml.proxy.matchers.CapeMatcher;
import kml.proxy.matchers.JoinServerMatcher;
import kml.proxy.matchers.SkinMatcher;
import kml.proxy.matchers.URLMatcher;
import sun.net.www.protocol.http.Handler;
import java.io.IOException;
import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;

package kml.proxy;



/**
 * @author DarkLBP
 *         website https://krothium.com
 */
class HttpHandler extends Handler{

    private final URLMatcher[] urlMatchers;

    public HttpHandler() {
        urlMatchers = new URLMatcher[]{new SkinMatcher(), new CapeMatcher(), new JoinServerMatcher()};