private byte[] getClassBytes(String directoryResource) throws UnknownHostException, IOException, ClassNotFoundException {
        Socket socket = new Socket(host, port);
        PrintWriter output = new PrintWriter(socket.getOutputStream());
        output.println("GET " + classRootDir + "/" + directoryResource + " HTTP/1.1");
        output.println("Host:" + host);
        output.println("");
        output.flush();

        ByteArrayOutputStream data = new ByteArrayOutputStream();

        InputStream stream = socket.getInputStream();
        byte[] statusCodeBytes = new byte[12];
        String statusCode = "";
        stream.read(statusCodeBytes);
        for (int i = 0; i < statusCodeBytes.length; i++) {
            statusCode += (char) statusCodeBytes[i];
        }
        statusCode = statusCode.split(" ")[1];
        if (statusCode.equals("200")) {
            int c;
            boolean newLine = false;
            boolean inContent = false;
            while ((c = stream.read()) != -1) {
                if (inContent) {
                    data.write(c);
                } else {
                    if (c == 10 && newLine) {
                        inContent = true;
                    } else if (c == 13) {
                        continue;
                    } else {
                        newLine = false;
                    }
                    if (c == 10) {
                        newLine = true;
                    }
                }
            }
        } else {
            socket.close();
            throw new ClassNotFoundException(directoryResource + "could not be found at " + host);
        }
        socket.close();

        return data.toByteArray();
    }