I have written java application that makes socket connections with a legacy system.
How can I simulate the connection failure (Eg Socket connection timeout, read timeout, network failure), so that i can add necessary code based on the exception trace ?
Use a mock framework such as Mockito or EasyMock, mock a Socket object.
Look at the Javadoc for Socket and make your mocked object fail at some point with an Exception thrown by it in your unit tests.