private void waitForAnswer(SocketIO socket, int code) {
        String string = socketIO.readString();
        int resCode = extractCode(string);
        if (code > 100 && code != resCode) {
            throw new IllegalStateException("The answer code is " + resCode + " but not " + code);
        } else if (code > 10 && code < 100 && code != resCode / 10) {
            throw new IllegalStateException("The answer code is " + resCode + " but not " + code + "*");
        } else if (code > 1 && code < 10 && code != resCode / 100) {
            throw new IllegalStateException("The answer code is " + resCode + " but not " + code + "**");
        }
    }