title: ServerSocket - how to keep client socket id
body: <p>I tried to extend Socket object something as...</p>
  
  <pre><code>public class TestSocket extends Socket
  {
    private String id=String.valueOf(Math.random());
  
    ...
  
    public void setId(String id){this.id=id;}
    public String getId(){return this.id;}
  
  }
  </code></pre>
  
  <p>init as...</p>
  
  <pre><code>TestSocket testSocket = new TestSocket(SERVER_HOSTNAME, SERVER_PORT);
  </code></pre>
  
  <p>As I can see it, the server side ServerSocket standard code like a </p>
  
  <pre><code>TestSocket mySocket = (TestSocket) serverSocket.accept();
  </code></pre>
  
  <p>... according to <a href="http://docs.oracle.com/javase/1.4.2/docs/api/java/net/ServerSocket.html#accept%28%29" rel="nofollow">docs</a> accept() method re-inits socket object and returns a new one so the id value is not the client's one but a regenerated one :( </p>
  
  <p>Is it possible to keep a client id? If yes then how?</p>