001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.commons.net.telnet;
018
019 /***
020 * JUnit test class for SuppressGAOptionHandler
021 * <p>
022 * @author Bruno D'Avanzo
023 ***/
024 public class SuppressGAOptionHandlerTest extends TelnetOptionHandlerTestAbstract
025 {
026 /***
027 * main for running the test.
028 ***/
029 public static void main(String args[])
030 {
031 junit.textui.TestRunner.run(SuppressGAOptionHandlerTest.class);
032 }
033
034 /***
035 * setUp for the test.
036 ***/
037 @Override
038 protected void setUp()
039 {
040 opthand1 = new SuppressGAOptionHandler();
041 opthand2 = new SuppressGAOptionHandler(true, true, true, true);
042 opthand3 = new SuppressGAOptionHandler(false, false, false, false);
043 }
044
045 /***
046 * test of the constructors.
047 ***/
048 @Override
049 public void testConstructors()
050 {
051 assertEquals(opthand1.getOptionCode(), TelnetOption.SUPPRESS_GO_AHEAD);
052 super.testConstructors();
053 }
054
055 /***
056 * test of client-driven subnegotiation.
057 * Checks that no subnegotiation is made.
058 ***/
059 @Override
060 public void testStartSubnegotiation()
061 {
062
063 int resp1[] = opthand1.startSubnegotiationLocal();
064 int resp2[] = opthand1.startSubnegotiationRemote();
065
066 assertEquals(resp1, null);
067 assertEquals(resp2, null);
068 }
069
070 /***
071 * test of server-driven subnegotiation.
072 * Checks that no subnegotiation is made.
073 ***/
074 @Override
075 public void testAnswerSubnegotiation()
076 {
077 int subn[] =
078 {
079 TelnetCommand.IAC, TelnetCommand.SB, TelnetOption.SUPPRESS_GO_AHEAD,
080 1, TelnetCommand.IAC, TelnetCommand.SE,
081 };
082
083 int resp1[] = opthand1.answerSubnegotiation(subn, subn.length);
084
085 assertEquals(resp1, null);
086 }
087 }