fix: sonarqube related issues
Various sonarqube issues addressed:
- S2142: re-interrupt InterruptedException
- S1192: using constant string
- S1604: using lambda instead of anonymous classes
- S112: changed generic exception
- S5778: limit lambda to only one invocation for testing exceptions
- S2925: removed thread.sleep