Kryonet - 'client.connect()' is stuck, has to be launched twice

Hello. I’m using Kryonet. After updating Android to 5.0, there were some changes, that broke Kryonet. Smart guys had to write a patch, cause UDP were not working etc.

Now, I’m experiencing a strange issue. Let’s say that I have a class like this (made it for testing):

public class Test {
    public static String host = "xxxxxx";
    // public static String host = "";
    public static int tcp_port = 8888, udp_port = 8889;
    Client c;

    public Test() {
         c = new Client();

    public void tryToConnect(){
        new Thread("Connect") {
            public void run () {
                try {
                    c.connect(5555, host, tcp_port, udp_port);
                    // Server communication after connection can go here, or in Listener#connected().
                } catch (IOException ex) {

In main class I have a button that runs tryToConnect():

  protected void onCreate(Bundle savedInstanceState) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        t = new Test();

 public void Login(View view) { // <<<<< This is the button onClick

I have already tried with running all of this in one block (registering client, connecting) - the same thing happens.

What’s the problem?

I open the APP (log level trace) and I can see, that Network.register© is fired, cause I see all of the 46 classes registering.
When I click the button and fire ‘client.connect(timeout,ip,port,port)’ nothing happens. Totally nothing. The console is empty (but the method has been runned), cause I have Sys.out(“Before”) and Sys.out(“After”) - as you can see in the code. ‘Before’ is in the console, ‘After’ isn’t. And the best part. When I click second time, IT CONNECTS, but twice. There is an info like:

[Kryo] Connecting with blabla on port blabla
[Kryo] Connecting with blabla on port blabla

What may cause this? I’m sitting here for 6 hours and I have tried everything already. Thanks.