title: Java Kryonet servers, client not receiving server response
body: <p>I am trying to teach myself some networking in Java using the Kryonet library. The following code is almost identical to the code in the kyronet tutorial. <a href="https://code.google.com/p/kryonet/#Running_a_server" rel="nofollow">https://code.google.com/p/kryonet/#Running_a_server</a></p>
  
  <p>The client is successfully sending the message "Here is the request!" to the server (the server is printing it out) however the client is not receiving any response from the server even though the server is sending one.</p>
  
  <p>I've tried unsuccessfully to fix it, can anyone see or suggest a possible problem/solution with the code?</p>
  
  <p>(The code follows)</p>
  
  <p>Client</p>
  
  <pre><code>public class Client_test {
  Client client = new Client();
  public Client_test() {
      Kryo kryo = client.getKryo();
      kryo.register(SomeRequest.class);
      kryo.register(SomeResponse.class);
      client.start();
      try {
          client.connect(50000, "127.0.0.1", 54555, 54777);
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  
      client.addListener(new Listener() {
             public void received (Connection connection, Object object) {
                if (object instanceof SomeResponse) {       
                   SomeResponse response = (SomeResponse)object;
                   System.out.println(response.text);
                }
             }
          });
      SomeRequest request = new SomeRequest();
      request.text = "Here is the request!";
      client.sendTCP(request);
  
  }
  
  }
  </code></pre>
  
  <p>Server</p>
  
  <pre><code>public class ServerGame {
  Server server = new Server();
  
  public ServerGame() {
      Kryo kryo = server.getKryo();
      kryo.register(SomeRequest.class);
      kryo.register(SomeResponse.class);
      server.start();
      try {
          server.bind(54555, 54777);
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
      server.addListener(new Listener() {
             public void received (Connection connection, Object object) {
                if (object instanceof SomeRequest) {
                   SomeRequest request = (SomeRequest)object;
                   System.out.println(request.text);
                   SomeResponse response = new SomeResponse();
                   response.text = "Thanks!";
                   connection.sendTCP(response);
                }
             }
          });
  }
  
  }
  </code></pre>
  
  <p>Response &amp; Request classes</p>
  
  <pre><code>public class SomeRequest {
  public String text;
  public SomeRequest(){}
  }
  
  public class SomeResponse {
  public String text;
  public SomeResponse(){}
  }
  </code></pre>