@@ -105,74 +105,74 @@ void _integrationSuite(
105105 SockJSClient createCorClient (),
106106 SockJSClient create404Client (),
107107) {
108- SockJSClient client;
108+ SockJSClient ? client;
109109
110110 tearDown (() async {
111- await client.dispose ();
111+ await client! .dispose ();
112112 client = null ;
113113 });
114114
115115 test ('connecting to a SockJS server' , () async {
116116 client = createEchoClient ();
117- expect ((await client.onOpen.first).transport, equals (expectedTransport));
117+ expect ((await client! .onOpen.first).transport, equals (expectedTransport));
118118 });
119119
120120 test ('sending and receiving messages' , () async {
121121 client = createEchoClient ();
122- await client.onOpen.first;
122+ await client! .onOpen.first;
123123
124124 final c = Completer <Null >();
125125 final echos = < String > [];
126- client.onMessage.listen ((message) {
126+ client! .onMessage.listen ((message) {
127127 echos.add (message.data);
128128 if (echos.length == 2 ) {
129129 c.complete ();
130130 }
131131 });
132- client
132+ client!
133133 ..send ('message1' )
134134 ..send ('message2' );
135135
136136 await c.future;
137- client.close ();
137+ client! .close ();
138138
139139 expect (echos, equals (['message1' , 'message2' ]));
140140 });
141141
142142 test ('client closing the connection' , () async {
143143 client = createEchoClient ();
144- await client.onOpen.first;
145- client.close ();
146- await client.onClose.first;
144+ await client! .onOpen.first;
145+ client! .close ();
146+ await client! .onClose.first;
147147 });
148148
149149 test ('client closing the connection with code and reason' , () async {
150150 client = createEchoClient ();
151- await client.onOpen.first;
152- client.close (4001 , 'Custom close.' );
153- final event = await client.onClose.first;
151+ await client! .onOpen.first;
152+ client! .close (4001 , 'Custom close.' );
153+ final event = await client! .onClose.first;
154154 expect (event.code, equals (4001 ));
155155 expect (event.reason, equals ('Custom close.' ));
156156 });
157157
158158 test ('server closing the connection' , () async {
159159 client = createCorClient ();
160- await client.onOpen.first;
161- client.send ('close' );
162- await client.onClose.first;
160+ await client! .onOpen.first;
161+ client! .send ('close' );
162+ await client! .onClose.first;
163163 });
164164
165165 test ('server closing the connection with code and reason' , () async {
166166 client = createCorClient ();
167- await client.onOpen.first;
168- client.send ('close::4001::Custom close.' );
169- final event = await client.onClose.first;
167+ await client! .onOpen.first;
168+ client! .send ('close::4001::Custom close.' );
169+ final event = await client! .onClose.first;
170170 expect (event.code, equals (4001 ));
171171 expect (event.reason, equals ('Custom close.' ));
172172 });
173173
174174 test ('handle failed connection' , () async {
175175 client = create404Client ();
176- await client.onClose.first;
176+ await client! .onClose.first;
177177 });
178178}
0 commit comments