@@ -17,9 +17,10 @@ import (
17
17
"testing"
18
18
"time"
19
19
20
+ "github.com/stretchr/testify/assert"
21
+
20
22
"github.com/ably/ably-go/ably"
21
23
"github.com/ably/ably-go/ablytest"
22
- "github.com/stretchr/testify/assert"
23
24
)
24
25
25
26
func Test_RTN2_WebsocketQueryParams (t * testing.T ) {
@@ -1129,73 +1130,6 @@ func TestRealtimeConn_RTN15c7_attached(t *testing.T) {
1129
1130
// ablytest.Soon.NoRecv(t, &msg, sub, t.Fatalf)
1130
1131
}
1131
1132
1132
- func TestRealtimeConn_RTN15c4 (t * testing.T ) {
1133
-
1134
- doEOF := make (chan struct {}, 1 )
1135
-
1136
- continueDial := make (chan struct {}, 1 )
1137
- continueDial <- struct {}{}
1138
- app , client := ablytest .NewRealtime (
1139
- ably .WithAutoConnect (false ),
1140
- ably .WithDial (func (protocol string , u * url.URL , timeout time.Duration ) (ably.Conn , error ) {
1141
- <- continueDial
1142
- c , err := ably .DialWebsocket (protocol , u , timeout )
1143
- return protoConnWithFakeEOF {
1144
- Conn : c ,
1145
- doEOF : doEOF ,
1146
- }, err
1147
- }))
1148
- defer safeclose (t , & closeClient {Closer : ablytest .FullRealtimeCloser (client ), skip : []int {http .StatusBadRequest }}, app )
1149
-
1150
- err := ablytest .Wait (ablytest .ConnWaiter (client , client .Connect , ably .ConnectionEventConnected ), nil )
1151
- assert .NoError (t , err , "Connect=%s" , err )
1152
-
1153
- channel := client .Channels .Get ("channel" )
1154
- err = channel .Attach (context .Background ())
1155
- assert .NoError (t , err )
1156
- chanStateChanges := make (ably.ChannelStateChanges , 1 )
1157
- off := channel .On (ably .ChannelEventFailed , chanStateChanges .Receive )
1158
- defer off ()
1159
-
1160
- connStateChanges := make (chan ably.ConnectionStateChange , 16 )
1161
- client .Connection .OnAll (func (c ably.ConnectionStateChange ) {
1162
- connStateChanges <- c
1163
- })
1164
-
1165
- client .Connection .SetKey ("wrong-conn-key" ) // wrong connection key for next resume request
1166
- doEOF <- struct {}{}
1167
-
1168
- var connState ably.ConnectionStateChange
1169
-
1170
- ablytest .Soon .Recv (t , & connState , connStateChanges , t .Fatalf )
1171
- assert .Equal (t , ably .ConnectionStateDisconnected , connState .Current ,
1172
- "expected transition to %v, got %v" , ably .ConnectionStateDisconnected , connState .Current )
1173
-
1174
- rest , err := ably .NewREST (app .Options ()... )
1175
- assert .NoError (t , err )
1176
- err = rest .Channels .Get ("channel" ).Publish (context .Background (), "name" , "data" )
1177
- assert .NoError (t , err )
1178
-
1179
- continueDial <- struct {}{}
1180
-
1181
- ablytest .Soon .Recv (t , & connState , connStateChanges , t .Fatalf )
1182
- assert .Equal (t , ably .ConnectionStateConnecting , connState .Current )
1183
-
1184
- // Connection goes into failed state
1185
- ablytest .Soon .Recv (t , & connState , connStateChanges , t .Fatalf )
1186
- assert .Equal (t , ably .ConnectionStateFailed , connState .Current )
1187
-
1188
- // Check channel goes into failed state
1189
- var change ably.ChannelStateChange
1190
- ablytest .Soon .Recv (t , & change , chanStateChanges , t .Fatalf )
1191
- assert .Equal (t , ably .ChannelStateFailed , change .Current )
1192
-
1193
- reason := client .Connection .ErrorReason ()
1194
- assert .NotNil (t , reason , "expected reason to be set" )
1195
- assert .Equal (t , http .StatusBadRequest , reason .StatusCode ,
1196
- "expected %d got %d" , http .StatusBadRequest , reason .StatusCode )
1197
- }
1198
-
1199
1133
func TestRealtimeConn_RTN15d_MessageRecovery (t * testing.T ) {
1200
1134
doEOF := make (chan struct {}, 1 )
1201
1135
allowDial := make (chan struct {}, 1 )
0 commit comments