When you encounter this error, please check whether you tried to use the mock object before invoking EasyMock.replay() method. I did that encountered the IllegalStateException and spent quite some time until I figured out the reason.
I had written the following expect() ;
the culprit was the following statement which I had put before the expect().
Hope it helps someone!