@@ -40,27 +40,29 @@ public void writeInexistentChannel() {
4040
4141 @ Test
4242 public void writeReadOnlyChannel () {
43- PVEventRecorder recorder = new PVEventRecorder ();
44- PV <VType , Object > pv = gpClient .readAndWrite ("sim://ramp" )
45- .addListener (recorder )
46- .start ();
47- recorder .wait (1000 , anEventOfType (READ_CONNECTION ));
48- recorder .wait (1000 , anEventOfType (EXCEPTION ));
49- assertThat (pv .isConnected (), equalTo (true ));
50- assertThat (pv .isWriteConnected (), equalTo (false ));
51- assertThat (recorder .getEvents ().get (1 ).getException (), instanceOf (ReadOnlyChannelException .class ));
43+ for (int i = 0 ; i < 100 ; i ++) {
44+ PVEventRecorder recorder = new PVEventRecorder ();
45+ PV <VType , Object > pv = gpClient .readAndWrite ("sim://ramp" )
46+ .addListener (recorder )
47+ .start ();
48+ recorder .wait (1000 , anEventOfType (READ_CONNECTION ));
49+ recorder .wait (1000 , anEventOfType (EXCEPTION ));
50+ assertThat (pv .isConnected (), equalTo (true ));
51+ assertThat (pv .isWriteConnected (), equalTo (false ));
52+ assertThat (recorder .getEvents ().get (recorder .getEvents ().size () - 1 ).getException (), instanceOf (ReadOnlyChannelException .class ));
53+ }
5254 }
5355
5456 @ Test (expected = RuntimeException .class )
5557 public void writeDisconnectedChannel () {
56- PV <VType , Object > pv = gpClient .readAndWrite ("loc://writeDisconnectedChannel" )
57- .addListener ((PVListener <VType , Object >) (PVEvent event , PV <VType , Object > pv1 ) -> {
58- // Do nothing
59- })
60- .start ();
58+ PV <VType , Object > pv = gpClient .readAndWrite ("loc://writeDisconnectedChannel" )
59+ .addListener ((PVListener <VType , Object >) (PVEvent event , PV <VType , Object > pv1 ) -> {
60+ // Do nothing
61+ })
62+ .start ();
6163// assertThat(pv.isWriteConnected(), equalTo(false));
62- pv .write ("Value" );
63- }
64+ pv .write ("Value" );
65+ }
6466
6567 @ Test (expected = RuntimeException .class )
6668 public void writeDisconnectedChannelAsynch () {
0 commit comments