Java Code Examples for org.apache.sshd.server.Environment#addSignalListener()
The following examples show how to use
org.apache.sshd.server.Environment#addSignalListener() .
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: TtyCommand.java From aesh-readline with Apache License 2.0 | 5 votes |
@Override public void start(final Environment env) throws IOException { String lcctype = env.getEnv().get("LC_CTYPE"); if (lcctype != null) { charset = parseCharset(lcctype); } if (charset == null) { charset = defaultCharset; } env.addSignalListener(signal -> updateSize(env), EnumSet.of(org.apache.sshd.server.Signal.WINCH)); updateSize(env); // Event handling int vintr = getControlChar(env, PtyMode.VINTR, 3); int veof = getControlChar(env, PtyMode.VEOF, 4); int vsusp = getControlChar(env, PtyMode.VSUSP, 26); device = new SSHDevice(env.getEnv().get("TERM")); attributes = SSHAttributesBuilder.builder().environment(env).build(); eventDecoder = new EventDecoder(attributes); decoder = new Decoder(512, charset, eventDecoder); stdout = new TtyOutputMode(new Encoder(charset, out)); conn = new SSHConnection(); session.setDataReceiver(this); handler.accept(conn); }
Example 2
Source File: TtyCommand.java From termd with Apache License 2.0 | 5 votes |
@Override public void start(final Environment env) throws IOException { String lcctype = env.getEnv().get("LC_CTYPE"); if (lcctype != null) { charset = parseCharset(lcctype); } if (charset == null) { charset = defaultCharset; } env.addSignalListener(signal -> updateSize(env), EnumSet.of(org.apache.sshd.server.Signal.WINCH)); updateSize(env); // Event handling int vintr = getControlChar(env, PtyMode.VINTR, 3); int vsusp = getControlChar(env, PtyMode.VSUSP, 26); int veof = getControlChar(env, PtyMode.VEOF, 4); // eventDecoder = new TtyEventDecoder(vintr, vsusp, veof); decoder = new BinaryDecoder(512, charset, eventDecoder); stdout = new TtyOutputMode(new BinaryEncoder(charset, out)); term = env.getEnv().get("TERM"); conn = new Connection(); // session.setDataReceiver(this); handler.accept(conn); }