+1  A: 

I'm not exactly clear on your question. Can you just try:

throw new SocketTimeoutException();

hohonuuli
My API access a WebServer, I'm writing a simulator for this webserver. If I throw a exception in the simulator I'll not receive this exception in my client. Is a client of a webservice. This simulator is to be used in the tool fitnesse.
Castanho
A: 

If the exception is based on the "keep alive" between sockets (what is the likely to cause the socket to timeout), you may have to make the socket connection across two computers and then remove the cable between them (or the connection to a switch). The the "keep alive" timeout occurs, hopefully you will get a SocketTimeoutException.

Depending upon the setting for the "keep alive" (You might be able to set this through socket options), it may take minutes to hours (NT was approximately 5 hour for a keep alive to time out, but it was setable in the registry).

If that does not give you the expected exception, I'm not sure what conditions need to occur to cause a timeout.

Might what to look at these links to see if they are any help.

http://www.velocityreviews.com/forums/t363525-sockettimeoutexception-read-timed-out.html

http://www.javakb.com/Uwe/Forum.aspx/java-programmer/29249/SocketTimeoutException-Read-timed-out

Glenn