client server socket communication
<p>we have built ap a system adapter (client) and a SUT (server) in order to send string messages between them through sockets. my intention is to do test cases.
the client sends a command, the sut does some stuff and sends a response. 
all is doing fine but after the 4th response is sent, by the time when the 5th has to be sent, i encountered the following problem:</p>

<pre><code>java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at Interface.run(Interface.java:131)
at Interface.createAndShowGUI(Interface.java:382)   //gui elements
at Interface.access$0(Interface.java:378)           //gui elements
at Interface$1.run(Interface.java:392)              //gui elements
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
</code></pre>

<hr>

<pre><code>do {                
    message = (String) in.readObject(); 
    System.out.println("client-from server&gt;" + message);
    if (message.contains("endTC")) {
            stateLabel.setText("OpenAndUnlocked");
    }
    else if (message.contains("closed")) {
            b1.doClick();
    } 
    else if (message.contains("lock")) {
            b2.doClick();
            } else if (message.contains("open")) {
                    b3.doClick();
            } else if (message.contains("unlock")) {
                    b4.doClick();
            } else if (message.contains("exit")) {
                    sendMessage("Exiting");
            }
} while (!message.equals("end"));  //always loop
</code></pre>
