2 // Copyright © 2011-2018 Guy M. Allard
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
27 Test Nack error cases.
29 func TestNackErrors(t
*testing
.T
) {
32 ch
= headersProtocol(ch
, sp
)
33 conn
, e
= Connect(n
, ch
)
35 t
.Fatalf("TestNackErrors CONNECT expected no error, got [%v]\n", e
)
37 for ti
, tv
:= range nackList
{
38 conn
.protocol
= tv
.proto
// Fake it
39 e
= conn
.Nack(tv
.headers
)
41 t
.Fatalf("TestNackErrors[%d] NACK -%s- expected error [%v], got [%v]\n",
42 ti
, tv
.proto
, tv
.errval
, e
)
46 checkReceived(t
, conn
, false)
47 e
= conn
.Disconnect(empty_headers
)
48 checkDisconnectError(t
, e
)