@Override
    protected Void doInBackground() throws Exception {
        Client loginClient = new Client(4096 * 2, 4096 * 2);

        loginClient.getKryo().setRegistrationRequired(false);
        
        loginClient.getKryo().register(PacketLogin.class);
        loginClient.getKryo().register(PacketLoginResponse.class);
        loginClient.getKryo().register(PacketRequestCaptcha.class);
        loginClient.getKryo().register(PacketCaptchaImage.class);
        
        loginClient.addListener(new Listener() {
            @Override
            public void received(Connection connection, Object object) {
                if (object instanceof PacketCaptchaImage) {
                    PacketCaptchaImage response = (PacketCaptchaImage) object;
                    System.out.println("Captcha: " + response.toString());
                    
                    publish(new CaptchaImageState(response));
                    
                    connection.close();
                }
            }
        });

        loginClient.start();

        try {
            loginClient.connect(5000, Constants.SERVER_HOST, Constants.SERVER_PORT);   
            
            PacketRequestCaptcha prc = new PacketRequestCaptcha();
            prc.username = login;
            prc.password = password;
            
            loginClient.sendTCP(prc);
        } catch (Exception e) {
            PacketCaptchaImage response = new PacketCaptchaImage();
            response.hasCaptcha = false;
            response.key = e.toString();
            
            publish(new CaptchaImageState(response));
            e.printStackTrace();
            
            return null;
        }
                      
        return null;
    }