public void receive(byte[] data) { for (byte b : data) { status.handle(this, b); } flushDataIfNecessary(); }
/** * Write a <i>do</i> option request to the client. * * @param option the option to send */ public final void writeDoOption(Option option) { send(new byte[]{BYTE_IAC, BYTE_DO, option.code}); }
@Override void handleWont(TelnetConnection session) { session.receiveBinary = false; session.handler.onReceiveBinary(false); } },
private void testOptionValue(Supplier<TelnetHandler> factory, TelnetOptionHandler optionHandler) throws Exception { server.start(factory); client.setOptionHandler(optionHandler); client.connect("localhost", 4000); await(); }
protected void server(Consumer<TtyConnection> onConnect) { server.start(() -> new TelnetTtyConnection(binary, binary, charset, onConnect)); }
@Override void handle(TelnetConnection session, byte b) { try { session.onOptionDont(b); } finally { session.status = DATA; } } },
@Override void handleWont(TelnetConnection session) { session.handler.onNAWS(false); } @Override
@Override void handleParameters(TelnetConnection session, byte[] parameters) { if (parameters.length == 4) { int width = ((parameters[0] & 0xff) << 8) + (parameters[1] & 0xff); int height = ((parameters[2] & 0xff) << 8) + (parameters[3] & 0xff); session.handler.onSize(width, height); } } }
@Override void handle(TelnetConnection session, byte b) { if (b == BYTE_IAC) { session.appendData((byte)-1); } else { session.flushDataIfNecessary(); IAC.handle(session, b); } } },
@Override void handle(TelnetConnection session, byte b) { try { session.onOptionDo(b); } finally { session.status = DATA; } } },
@Override void handleDont(TelnetConnection session) { session.sendBinary = false; session.handler.onSendBinary(false); }
private void testOptionValue(Supplier<TelnetHandler> factory, TelnetOptionHandler optionHandler) throws Exception { server.start(factory); client.setOptionHandler(optionHandler); client.connect("localhost", 4000); await(); }
public void receive(byte[] data) { for (byte b : data) { status.handle(this, b); } flushDataIfNecessary(); }
/** * Write a do <i>will</i> request to the client. * * @param option the option to send */ public final void writeWillOption(Option option) { send(new byte[]{BYTE_IAC, BYTE_WILL, option.code}); }
@Override void handleWill(TelnetConnection session) { session.receiveBinary = true; session.handler.onReceiveBinary(true); }
private void testOptionValue(Supplier<TelnetHandler> factory, TelnetOptionHandler optionHandler) throws Exception { server.start(factory); client.setOptionHandler(optionHandler); client.connect("localhost", 4000); await(); }
@Override void handleWill(TelnetConnection session) { session.send(new byte[]{TelnetConnection.BYTE_IAC, TelnetConnection.BYTE_SB, code, BYTE_SEND, TelnetConnection.BYTE_IAC, TelnetConnection.BYTE_SE}); } @Override
/** * Write a do <i>will</i> request to the client. * * @param option the option to send */ public final void writeWillOption(Option option) { send(new byte[]{BYTE_IAC, BYTE_WILL, option.code}); }