title: Closing ServerSocket - how to properly check if client socket is closed?
body: <p>I create a new thread that runs the following code:</p>
  
  <pre><code>public static void startServer() throws IOException {
      serverSocket = new ServerSocket(55000);
      Socket clientSocket = serverSocket.accept(); 
  }
  </code></pre>
  
  <p>The above code is run in a thread. Now, in my main class, I successfully create a socket
  connection to the server and I have checked it's integrity which is fine. here is the code:</p>
  
  <pre><code>Socket testServerSocket = new Socket("127.0.0.1", 55000);
  assertEquals("/127.0.0.1", testServerSocket.getInetAddress().toString());
  assertEquals(55000, testServerSocket.getPort());
  </code></pre>
  
  <p>This runs perfect. Then, again from my main, I kill the server connection that closes the connection on the server side. However the following code keeps failing:
  assertEquals(false, testServerSocket.isBound());</p>
  
  <p>It keeps returning true. Likewise, if I check the remote IP address for the connection, it doesn't return null, but rather '/127.0.0.1'. Any ideas why this might be happening? Many thanks for your help</p>