01: /*
02: * Copyright 2003-2004 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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.
15: */
16: package org.apache.commons.net.telnet;
17:
18: /***
19: * JUnit test class for SuppressGAOptionHandler
20: * <p>
21: * @author Bruno D'Avanzo
22: ***/
23: public class SuppressGAOptionHandlerTest extends
24: TelnetOptionHandlerTestAbstract {
25: /***
26: * main for running the test.
27: ***/
28: public static void main(String args[]) {
29: junit.textui.TestRunner.run(SuppressGAOptionHandlerTest.class);
30: }
31:
32: /***
33: * setUp for the test.
34: ***/
35: protected void setUp() {
36: opthand1 = new SuppressGAOptionHandler();
37: opthand2 = new SuppressGAOptionHandler(true, true, true, true);
38: opthand3 = new SuppressGAOptionHandler(false, false, false,
39: false);
40: }
41:
42: /***
43: * test of the constructors.
44: ***/
45: public void testConstructors() {
46: assertEquals(opthand1.getOptionCode(),
47: TelnetOption.SUPPRESS_GO_AHEAD);
48: super .testConstructors();
49: }
50:
51: /***
52: * test of client-driven subnegotiation.
53: * Checks that no subnegotiation is made.
54: ***/
55: public void testStartSubnegotiation() {
56:
57: int resp1[] = opthand1.startSubnegotiationLocal();
58: int resp2[] = opthand1.startSubnegotiationRemote();
59:
60: assertEquals(resp1, null);
61: assertEquals(resp2, null);
62: }
63:
64: /***
65: * test of server-driven subnegotiation.
66: * Checks that no subnegotiation is made.
67: ***/
68: public void testAnswerSubnegotiation() {
69: int subn[] = { TelnetCommand.IAC, TelnetCommand.SB,
70: TelnetOption.SUPPRESS_GO_AHEAD, 1, TelnetCommand.IAC,
71: TelnetCommand.SE, };
72:
73: int resp1[] = opthand1.answerSubnegotiation(subn, subn.length);
74:
75: assertEquals(resp1, null);
76: }
77: }
|