org.apache.commons.net.telnet.InvalidTelnetOptionException Java Examples
The following examples show how to use
org.apache.commons.net.telnet.InvalidTelnetOptionException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DeviceTest.java From Chorus-RF-Laptimer with MIT License | 6 votes |
private void telnetParameters(int baudRate, int dataBits, int stopBits, int parity) throws IOException, InterruptedException, InvalidTelnetOptionException { telnetComPortOptionCounter[0] = 0; telnetClient.sendCommand((byte)TelnetCommand.SB); telnetWriteStream.write(new byte[] {RFC2217_COM_PORT_OPTION, RFC2217_SET_BAUDRATE, (byte)(baudRate>>24), (byte)(baudRate>>16), (byte)(baudRate>>8), (byte)baudRate}); telnetClient.sendCommand((byte)TelnetCommand.SE); telnetClient.sendCommand((byte)TelnetCommand.SB); telnetWriteStream.write(new byte[] {RFC2217_COM_PORT_OPTION, RFC2217_SET_DATASIZE, (byte)dataBits}); telnetClient.sendCommand((byte)TelnetCommand.SE); telnetClient.sendCommand((byte)TelnetCommand.SB); telnetWriteStream.write(new byte[] {RFC2217_COM_PORT_OPTION, RFC2217_SET_STOPSIZE, (byte)stopBits}); telnetClient.sendCommand((byte)TelnetCommand.SE); telnetClient.sendCommand((byte)TelnetCommand.SB); telnetWriteStream.write(new byte[] {RFC2217_COM_PORT_OPTION, RFC2217_SET_PARITY, (byte)(parity+1)}); telnetClient.sendCommand((byte)TelnetCommand.SE); // windows does not like nonstandard baudrates. rfc2217_server.py terminates w/o response for(int i=0; i<2000; i++) { if(telnetComPortOptionCounter[0] == 4) break; Thread.sleep(1); } assertEquals("telnet connection lost", 4, telnetComPortOptionCounter[0].intValue()); }
Example #2
Source File: DeviceTest.java From usb-serial-for-android with GNU Lesser General Public License v2.1 | 6 votes |
private void telnetParameters(int baudRate, int dataBits, int stopBits, int parity) throws IOException, InterruptedException, InvalidTelnetOptionException { telnetComPortOptionCounter[0] = 0; telnetClient.sendCommand((byte)TelnetCommand.SB); telnetWriteStream.write(new byte[] {RFC2217_COM_PORT_OPTION, RFC2217_SET_BAUDRATE, (byte)(baudRate>>24), (byte)(baudRate>>16), (byte)(baudRate>>8), (byte)baudRate}); telnetClient.sendCommand((byte)TelnetCommand.SE); telnetClient.sendCommand((byte)TelnetCommand.SB); telnetWriteStream.write(new byte[] {RFC2217_COM_PORT_OPTION, RFC2217_SET_DATASIZE, (byte)dataBits}); telnetClient.sendCommand((byte)TelnetCommand.SE); telnetClient.sendCommand((byte)TelnetCommand.SB); telnetWriteStream.write(new byte[] {RFC2217_COM_PORT_OPTION, RFC2217_SET_STOPSIZE, (byte)stopBits}); telnetClient.sendCommand((byte)TelnetCommand.SE); telnetClient.sendCommand((byte)TelnetCommand.SB); telnetWriteStream.write(new byte[] {RFC2217_COM_PORT_OPTION, RFC2217_SET_PARITY, (byte)(parity+1)}); telnetClient.sendCommand((byte)TelnetCommand.SE); // windows does not like nonstandard baudrates. rfc2217_server.py terminates w/o response for(int i=0; i<TELNET_COMMAND_WAIT; i++) { if(telnetComPortOptionCounter[0] == 4) break; Thread.sleep(1); } assertEquals("telnet connection lost", 4, telnetComPortOptionCounter[0].intValue()); }
Example #3
Source File: TelnetClientRule.java From termd with Apache License 2.0 | 4 votes |
public void setOptionHandler(TelnetOptionHandler handler) throws IOException, InvalidTelnetOptionException { checkNotConnected(); client.addOptionHandler(handler); }
Example #4
Source File: TelnetClientRule.java From aesh-readline with Apache License 2.0 | 4 votes |
public void setOptionHandler(TelnetOptionHandler handler) throws IOException, InvalidTelnetOptionException { checkNotConnected(); client.addOptionHandler(handler); }
Example #5
Source File: TelnetClientRule.java From termd with Apache License 2.0 | 4 votes |
public void setOptionHandler(TelnetOptionHandler handler) throws IOException, InvalidTelnetOptionException { checkNotConnected(); client.addOptionHandler(handler); }