WriteUTF only works every 2nd time
<p>I'm having a little trouble with a simple Java server, client application.
Basically the topics says it all: when I do a writeUTF on the server side it only sends every 2nd time it's being executed.
For an example:</p>

<p>Server:</p>

<pre><code>public class Server {

    /**
     * @param args
     */
    public static void main(String[] args) {
        try {
            ServerSocket server     = new ServerSocket(7777);
            Socket client           = server.accept();
            DataOutputStream out    = new DataOutputStream(new BufferedOutputStream(client.getOutputStream()));
            DataInputStream in      = new DataInputStream(new BufferedInputStream(client.getInputStream()));
            while(true) {
                for(int i = 0; i &lt; 100; i++) {
                    out.writeUTF("Test" + i);
                    out.flush();
                }
            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}
</code></pre>

<p>And client: </p>

<pre><code>public class Client {

    /**
     * @param args
     */
    public static void main(String[] args) {
        try {
            Socket client           = new Socket("localhost", 7777);
            DataInputStream in      = new DataInputStream(new BufferedInputStream(client.getInputStream()));
            DataOutputStream out    = new DataOutputStream(new BufferedOutputStream(client.getOutputStream()));

            while(in.readUTF() != null) {
                System.out.println(in.readUTF());
            }
        } catch (UnknownHostException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}
</code></pre>

<p>And the output in the console looks like this:</p>

<p>Test1
Test3
Test5
Test7
Test9
Test11</p>

<p>What is causing this behavior?</p>
