config.setTrafficClass(1234);
verify(socket).setTrafficClass(eq(1234));
verifyNoMoreInteractions(socket);
// handle error
when(socket.getTrafficClass()).thenThrow(new SocketException("test"));
try {
config.getTrafficClass();
fail();
} catch (ConfigurationException e) {
assertEquals("test", e.getCause().getMessage());
}
// handle error
doThrow(new SocketException("test")).when(socket).setTrafficClass(eq(1234));
try {
config.setTrafficClass(1234);
fail();
} catch (ConfigurationException e) {
assertEquals("test", e.getCause().getMessage());