@Test
public void shouldNotAllowDuplicateDelegates() throws Exception {

  connection.setDelegate(delegate);
  assertThatThrownBy(() -> connection.setDelegate(new RecordingConnection<>()))
      .isInstanceOf(IllegalStateException.class);
}