send color object over socket java
<p>When I want to send <code>Color</code> object ovear socket, the method <code>writeObject</code> does not work. ...</p>

<pre><code>public class Server {
public static void main(String[] args) throws IOException, InterruptedException {
    ServerSocket listener = new ServerSocket(9090);
    while (true) {
        Socket socket = listener.accept();
        ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());
        out.writeObject(Color.red);
        out.writeObject(Color.red);
        out.writeObject(Color.red);
    }
}
}
</code></pre>

<p>...</p>

<pre><code>public class Client {
public static void main(String[] args) throws IOException, ClassNotFoundException {
    Socket socket = new Socket("", 9090);
    ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
    System.out.println(in.readObject());
    System.out.println(Color.red == in.readObject());
    System.out.println(new Color(255, 0, 0) == in.readObject());
}
}
</code></pre>

<p>output:</p>

<pre><code>java.awt.Color[r=255,g=0,b=0]
false //the output must be true
false //thre output must be true
</code></pre>