@Override
    protected Void doInBackground() throws Exception {
        Client client = new Client();

        client.getKryo().register(PacketLogin.class);
        client.getKryo().register(PacketLoginResponse.class);
        client.getKryo().register(PacketRequestCaptcha.class);
        client.getKryo().register(PacketCaptchaImage.class);
        client.getKryo().register(byte[].class);
        client.getKryo().register(PacketRegister.class);
        client.getKryo().register(PacketRegistered.class);
        client.getKryo().register(PacketFilesListRequest.class);
        client.getKryo().register(PacketFilesList.class);
        client.getKryo().register(String[].class);


        client.addListener(new Listener() {
            @Override
            public void received(Connection connection, Object object) {
                if (object instanceof PacketLoginResponse) {
                    PacketLoginResponse response = (PacketLoginResponse) object;
                    System.out.println(response.isSuccess + " : " + response.reason + " : " + response.session);

                    publish(new LoginState(response));

                    connection.close();
                }
            }
        });

        client.start();

        try {
            client.connect(5000, Constants.SERVER_HOST, Constants.SERVER_PORT);
            client.sendTCP(new PacketLogin(login, password));
        } catch (Exception e) {
            PacketLoginResponse response = new PacketLoginResponse();
            response.isSuccess = false;
            response.reason = e.toString();
            response.session = "";
            
            publish(new LoginState(response));
            
            e.printStackTrace();
            return null;
        }

        return null;
    }