class Viewer extends ClassLoader {
    private String server;
    private int port;

    /**
     * Starts a program.
     */
    public static void main(String[] args) throws Throwable {
        if (args.length >= 3) {
            Viewer cl = new Viewer(args[0], Integer.parseInt(args[1]));
            String[] args2 = new String[args.length - 3];
            System.arraycopy(args, 3, args2, 0, args.length - 3);
            cl.run(args[2], args2);
        }
        else
            System.err.println(
        "Usage: java javassist.tools.web.Viewer <host> <port> class [args ...]");
    }

    /**
     * Constructs a viewer.
     *
     * @param host              server name
     * @param p                 port number
     */
    public Viewer(String host, int p) {
        server = host;
        port = p;
    }

    /**
     * Returns the server name.
     */
    public String getServer() { return server; }

    /**
     * Returns the port number.
     */
    public int getPort() { return port; }

    /**
     * Invokes main() in the class specified by <code>classname</code>.
     *
     * @param classname         executed class
     * @param args              the arguments passed to <code>main()</code>.
     */
    public void run(String classname, String[] args)
        throws Throwable
    {
        Class<?> c = loadClass(classname);
        try {
            c.getDeclaredMethod("main", new Class[] { String[].class })
                .invoke(null, new Object[] { args });
        }
        catch (java.lang.reflect.InvocationTargetException e) {
            throw e.getTargetException();
        }
    }

    /**
     * Requests the class loader to load a class.
     */
    @Override
    protected synchronized Class<?> loadClass(String name, boolean resolve)
        throws ClassNotFoundException
    {<FILL_FUNCTION_BODY>}

    /**
     * Finds the specified class.  The implementation in this class
     * fetches the class from the http server.  If the class is
     * either <code>java.*</code>, <code>javax.*</code>, or
     * <code>Viewer</code>, then it is loaded by the parent class
     * loader.
     *
     * <p>This method can be overridden by a subclass of
     * <code>Viewer</code>.
     */
    @Override
    protected Class<?> findClass(String name) throws ClassNotFoundException {
        Class<?> c = null;
        if (name.startsWith("java.") || name.startsWith("javax.")
            || name.equals("org.hotswap.agent.javassist.tools.web.Viewer"))
            c = findSystemClass(name);

        if (c == null)
            try {
                byte[] b = fetchClass(name);
                if (b != null)
                    c = defineClass(name, b, 0, b.length);
            }
        catch (Exception e) {
        }

        return c;
    }

    /**
     * Fetches the class file of the specified class from the http
     * server.
     */
    protected byte[] fetchClass(String classname) throws Exception
    {
        byte[] b;
        URL url = new URL("http", server, port,
                          "/" + classname.replace('.', '/') + ".class");
        URLConnection con = url.openConnection();
        con.connect();
        int size = con.getContentLength();
        InputStream s = con.getInputStream();
        if (size <= 0)
            b = readStream(s);
        else {
            b = new byte[size];
            int len = 0;
            do {
                int n = s.read(b, len, size - len);
                if (n < 0) {
                    s.close();
                    throw new IOException("the stream was closed: "
                                          + classname);
                }
                len += n;
            } while (len < size);
        }

        s.close();
        return b;
    }

    private byte[] readStream(InputStream fin) throws IOException {
        byte[] buf = new byte[4096];
        int size = 0;
        int len = 0;
        do {
            size += len;
            if (buf.length - size <= 0) {
                byte[] newbuf = new byte[buf.length * 2];
                System.arraycopy(buf, 0, newbuf, 0, size);
                buf = newbuf;
            }

            len = fin.read(buf, size, buf.length - size);
        } while (len >= 0);

        byte[] result = new byte[size];
        System.arraycopy(buf, 0, result, 0, size);
        return result;
    }
}

        Class<?> c = findLoadedClass(name);
        if (c == null)
            c = findClass(name);

        if (c == null)
            throw new ClassNotFoundException(name);

        if (resolve)
            resolveClass(c);

        return c;
    
<methods>public void clearAssertionStatus() ,public final java.lang.Package getDefinedPackage(java.lang.String) ,public final java.lang.Package[] getDefinedPackages() ,public java.lang.String getName() ,public final java.lang.ClassLoader getParent() ,public static java.lang.ClassLoader getPlatformClassLoader() ,public java.net.URL getResource(java.lang.String) ,public java.io.InputStream getResourceAsStream(java.lang.String) ,public Enumeration<java.net.URL> getResources(java.lang.String) throws java.io.IOException,public static java.lang.ClassLoader getSystemClassLoader() ,public static java.net.URL getSystemResource(java.lang.String) ,public static java.io.InputStream getSystemResourceAsStream(java.lang.String) ,public static Enumeration<java.net.URL> getSystemResources(java.lang.String) throws java.io.IOException,public final java.lang.Module getUnnamedModule() ,public final boolean isRegisteredAsParallelCapable() ,public Class<?> loadClass(java.lang.String) throws java.lang.ClassNotFoundException,public Stream<java.net.URL> resources(java.lang.String) ,public void setClassAssertionStatus(java.lang.String, boolean) ,public void setDefaultAssertionStatus(boolean) ,public void setPackageAssertionStatus(java.lang.String, boolean) <variables>static final boolean $assertionsDisabled,final java.lang.Object assertionLock,Map<java.lang.String,java.lang.Boolean> classAssertionStatus,private volatile ConcurrentHashMap<?,?> classLoaderValueMap,private final ArrayList<Class<?>> classes,private boolean defaultAssertionStatus,private final java.security.ProtectionDomain defaultDomain,private final jdk.internal.loader.NativeLibraries libraries,private final java.lang.String name,private final java.lang.String nameAndId,private static final java.security.cert.Certificate[] nocerts,private final ConcurrentHashMap<java.lang.String,java.security.cert.Certificate[]> package2certs,private Map<java.lang.String,java.lang.Boolean> packageAssertionStatus,private final ConcurrentHashMap<java.lang.String,java.lang.NamedPackage> packages,private final ConcurrentHashMap<java.lang.String,java.lang.Object> parallelLockMap,private final java.lang.ClassLoader parent,private static volatile java.lang.ClassLoader scl,private final java.lang.Module unnamedModule