// Path: src/main/java/com/github/koraktor/steamcondenser/servers/packets/S2A_INFO_BasePacket.java
// public abstract class S2A_INFO_BasePacket extends SteamPacket {
// 
//     protected HashMap<String, Object> info;
// 
//     S2A_INFO_BasePacket(byte headerByte, byte[] dataBytes) {
//         super(headerByte, dataBytes);
// 
//         this.info = new HashMap<>();
//     }
// 
//     /**
//      * Returns a generated array of server properties from the instance
//      * variables of the packet object
//      *
//      * @return The information provided by the server
//      */
//     public HashMap<String, Object> getInfo() {
//         return this.info;
//     }
// 
// }
// 
// Path: src/main/java/com/github/koraktor/steamcondenser/servers/packets/S2A_PLAYER_Packet.java
// public class S2A_PLAYER_Packet extends SteamPacket {
// 
//     private HashMap<String, SteamPlayer> playerHash;
// 
//     /**
//      * Creates a new S2A_PLAYER response object based on the given data
//      *
//      * @param dataBytes The raw packet data sent by the server
//      */
//     public S2A_PLAYER_Packet(byte[] dataBytes)
//             throws PacketFormatException {
//         super(SteamPacket.S2A_PLAYER_HEADER, dataBytes);
// 
//         if(this.contentData.getLength() == 0) {
//             throw new PacketFormatException("Wrong formatted S2A_PLAYER response packet.");
//         }
// 
//         this.playerHash = new HashMap<>(this.contentData.getByte());
// 
//         while(this.contentData.hasRemaining()) {
//             int playerId = this.contentData.getByte() & 0xff;
//             String playerName = this.contentData.getString();
//             this.playerHash.put(playerName, new SteamPlayer(
//                 playerId,
//                 playerName,
//                 Integer.reverseBytes(this.contentData.getInt()),
//                 Float.intBitsToFloat(Integer.reverseBytes(this.contentData.getInt()))
//             ));
//         }
//     }
// 
//     /**
//      * Returns the list of active players provided by the server
//      *
//      * @return All active players on the server
//      */
//     public HashMap<String, SteamPlayer> getPlayerHash() {
//         return this.playerHash;
//     }
// }
// 
// Path: src/main/java/com/github/koraktor/steamcondenser/servers/packets/S2A_RULES_Packet.java
// public class S2A_RULES_Packet extends SteamPacket {
// 
//     private HashMap<String, String> rulesHash;
// 
//     /**
//      * Creates a new S2A_RULES response object based on the given data
//      *
//      * @param dataBytes The raw packet data sent by the server
//      */
//     public S2A_RULES_Packet(byte[] dataBytes)
//             throws PacketFormatException {
//         super(SteamPacket.S2A_RULES_HEADER, dataBytes);
// 
//         if (this.contentData.getLength() == 0) {
//             throw new PacketFormatException("Wrong formatted S2A_RULES response packet.");
//         }
// 
//         int rulesCount = Short.reverseBytes(this.contentData.getShort());
//         this.rulesHash = new HashMap<>(rulesCount);
// 
//         String rule;
//         String value;
//         for (int i = 0; i < rulesCount; i++) {
//             rule = this.contentData.getString();
//             value = this.contentData.getString();
// 
//             if(rule.equals("")) {
//                 break;
//             }
// 
//             this.rulesHash.put(rule, value);
//         }
//     }
// 
//     /**
//      * Returns the list of server rules (a.k.a. CVars) with the current values
//      *
//      * @return array A list of server rules
//      */
//     public HashMap<String, String> getRulesHash() {
//         return this.rulesHash;
//     }
// }


import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.TimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.koraktor.steamcondenser.exceptions.SteamCondenserException;
import com.github.koraktor.steamcondenser.servers.packets.A2S_INFO_Packet;
import com.github.koraktor.steamcondenser.servers.packets.A2S_PLAYER_Packet;
import com.github.koraktor.steamcondenser.servers.packets.A2S_RULES_Packet;
import com.github.koraktor.steamcondenser.servers.packets.S2A_INFO_BasePacket;
import com.github.koraktor.steamcondenser.servers.packets.S2A_PLAYER_Packet;
import com.github.koraktor.steamcondenser.servers.packets.S2A_RULES_Packet;
import com.github.koraktor.steamcondenser.servers.packets.S2C_CHALLENGE_Packet;
import com.github.koraktor.steamcondenser.servers.packets.SteamPacket;
import com.github.koraktor.steamcondenser.servers.sockets.QuerySocket;
            throws SteamCondenserException, TimeoutException {
        Class<? extends SteamPacket> expectedResponse = SteamPacket.class;
        SteamPacket requestPacket = null;

        switch(requestType) {
            case GameServer.REQUEST_CHALLENGE:
                expectedResponse = S2C_CHALLENGE_Packet.class;
                requestPacket = new A2S_PLAYER_Packet();
                break;
            case GameServer.REQUEST_INFO:
                expectedResponse = S2A_INFO_BasePacket.class;
                requestPacket = new A2S_INFO_Packet();
                break;
            case GameServer.REQUEST_PLAYER:
                expectedResponse = S2A_PLAYER_Packet.class;
                requestPacket = new A2S_PLAYER_Packet(this.challengeNumber);
                break;
            case GameServer.REQUEST_RULES:
                expectedResponse = S2A_RULES_Packet.class;
                requestPacket = new A2S_RULES_Packet(this.challengeNumber);
                break;
        }

        this.sendRequest(requestPacket);

        SteamPacket responsePacket = this.getReply();

        if(S2A_INFO_BasePacket.class.isInstance(responsePacket)) {
            this.serverInfo = ((S2A_INFO_BasePacket) responsePacket).getInfo();
        } else if(responsePacket instanceof S2A_PLAYER_Packet) {
// Path: src/main/java/com/github/koraktor/steamcondenser/servers/packets/S2A_INFO_BasePacket.java
// public abstract class S2A_INFO_BasePacket extends SteamPacket {
// 
//     protected HashMap<String, Object> info;
// 
//     S2A_INFO_BasePacket(byte headerByte, byte[] dataBytes) {
//         super(headerByte, dataBytes);
// 
//         this.info = new HashMap<>();
//     }
// 
//     /**
//      * Returns a generated array of server properties from the instance
//      * variables of the packet object
//      *
//      * @return The information provided by the server
//      */
//     public HashMap<String, Object> getInfo() {
//         return this.info;
//     }
// 
// }
// 
// Path: src/main/java/com/github/koraktor/steamcondenser/servers/packets/S2A_PLAYER_Packet.java
// public class S2A_PLAYER_Packet extends SteamPacket {
// 
//     private HashMap<String, SteamPlayer> playerHash;
// 
//     /**
//      * Creates a new S2A_PLAYER response object based on the given data
//      *
//      * @param dataBytes The raw packet data sent by the server
//      */
//     public S2A_PLAYER_Packet(byte[] dataBytes)
//             throws PacketFormatException {
//         super(SteamPacket.S2A_PLAYER_HEADER, dataBytes);
// 
//         if(this.contentData.getLength() == 0) {
//             throw new PacketFormatException("Wrong formatted S2A_PLAYER response packet.");
//         }
// 
//         this.playerHash = new HashMap<>(this.contentData.getByte());
// 
//         while(this.contentData.hasRemaining()) {
//             int playerId = this.contentData.getByte() & 0xff;
//             String playerName = this.contentData.getString();
//             this.playerHash.put(playerName, new SteamPlayer(
//                 playerId,
//                 playerName,
//                 Integer.reverseBytes(this.contentData.getInt()),
//                 Float.intBitsToFloat(Integer.reverseBytes(this.contentData.getInt()))
//             ));
//         }
//     }
// 
//     /**
//      * Returns the list of active players provided by the server
//      *
//      * @return All active players on the server
//      */
//     public HashMap<String, SteamPlayer> getPlayerHash() {
//         return this.playerHash;
//     }
// }
// 
// Path: src/main/java/com/github/koraktor/steamcondenser/servers/packets/S2A_RULES_Packet.java
// public class S2A_RULES_Packet extends SteamPacket {
// 
//     private HashMap<String, String> rulesHash;
// 
//     /**
//      * Creates a new S2A_RULES response object based on the given data
//      *
//      * @param dataBytes The raw packet data sent by the server
//      */
//     public S2A_RULES_Packet(byte[] dataBytes)
//             throws PacketFormatException {
//         super(SteamPacket.S2A_RULES_HEADER, dataBytes);
// 
//         if (this.contentData.getLength() == 0) {
//             throw new PacketFormatException("Wrong formatted S2A_RULES response packet.");
//         }
// 
//         int rulesCount = Short.reverseBytes(this.contentData.getShort());
//         this.rulesHash = new HashMap<>(rulesCount);
// 
//         String rule;
//         String value;
//         for (int i = 0; i < rulesCount; i++) {
//             rule = this.contentData.getString();
//             value = this.contentData.getString();
// 
//             if(rule.equals("")) {
//                 break;
//             }
// 
//             this.rulesHash.put(rule, value);
//         }
//     }
// 
//     /**
//      * Returns the list of server rules (a.k.a. CVars) with the current values
//      *
//      * @return array A list of server rules
//      */
//     public HashMap<String, String> getRulesHash() {
//         return this.rulesHash;
//     }
// }


// Path: src/main/java/com/github/koraktor/steamcondenser/servers/GameServer.java
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.TimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.koraktor.steamcondenser.exceptions.SteamCondenserException;
import com.github.koraktor.steamcondenser.servers.packets.A2S_INFO_Packet;
import com.github.koraktor.steamcondenser.servers.packets.A2S_PLAYER_Packet;
import com.github.koraktor.steamcondenser.servers.packets.A2S_RULES_Packet;
import com.github.koraktor.steamcondenser.servers.packets.S2A_INFO_BasePacket;
import com.github.koraktor.steamcondenser.servers.packets.S2A_PLAYER_Packet;
import com.github.koraktor.steamcondenser.servers.packets.S2A_RULES_Packet;
import com.github.koraktor.steamcondenser.servers.packets.S2C_CHALLENGE_Packet;
import com.github.koraktor.steamcondenser.servers.packets.SteamPacket;
import com.github.koraktor.steamcondenser.servers.sockets.QuerySocket;

            throws SteamCondenserException, TimeoutException {
        Class<? extends SteamPacket> expectedResponse = SteamPacket.class;
        SteamPacket requestPacket = null;

        switch(requestType) {
            case GameServer.REQUEST_CHALLENGE:
                expectedResponse = S2C_CHALLENGE_Packet.class;
                requestPacket = new A2S_PLAYER_Packet();
                break;
            case GameServer.REQUEST_INFO:
                expectedResponse = S2A_INFO_BasePacket.class;
                requestPacket = new A2S_INFO_Packet();
                break;
            case GameServer.REQUEST_PLAYER:
                expectedResponse = S2A_PLAYER_Packet.class;
                requestPacket = new A2S_PLAYER_Packet(this.challengeNumber);
                break;
            case GameServer.REQUEST_RULES:
                expectedResponse = S2A_RULES_Packet.class;
                requestPacket = new A2S_RULES_Packet(this.challengeNumber);
                break;
        }

        this.sendRequest(requestPacket);

        SteamPacket responsePacket = this.getReply();

        if(S2A_INFO_BasePacket.class.isInstance(responsePacket)) {
            this.serverInfo = ((S2A_INFO_BasePacket) responsePacket).getInfo();
        } else if(responsePacket instanceof S2A_PLAYER_Packet) {
            this.playerHash = ((S2A_PLAYER_Packet) responsePacket).getPlayerHash();