If you get an error, the server may not be running, or you may be trying to answer the question before it is asked.
In 1993 a cartoon by P. Steiner appeared in the New Yorker magazine. A dog was typing at a computer and talking to another dog over its shoulder: "On the internet, nobody knows you're a dog."
This server was taken from the book Just Java, by Peter van
der Linden, published by Prentice-Hall. It attempts to determine if a client
is a dog by asking it a question. The client answers the question and the server
determines if the client is a dog or not. The question is: "If I met you would
you shake my hand, or sniff it?"
You can see the cartoon at http://www.unc.edu/depts/jomc/academics/dri/idog.html
Here is the DogServer code.
Here is the DogApplet code.