protected void server(final Consumer<TtyConnection> onConnect) { server.start(new Supplier<TelnetHandler>() { @Override public TelnetHandler get() { return new TelnetTtyConnection(binary, binary, charset, onConnect); } }); }
protected void server(Consumer<TtyConnection> onConnect) { server.start(() -> new TelnetTtyConnection(binary, binary, charset, onConnect)); }
protected void server(Consumer<TtyConnection> onConnect) { server.start(() -> new TelnetTtyConnection(binary, binary, charset, onConnect)); }
@Test public void testOpen() throws Exception { server.start(() -> new TelnetHandler() { @Override protected void onOpen(TelnetConnection conn) { testComplete(); } }); client.connect("localhost", 4000); await(); }
private void testOptionValue(Supplier<TelnetHandler> factory, TelnetOptionHandler optionHandler) throws Exception { server.start(factory); client.setOptionHandler(optionHandler); client.connect("localhost", 4000); await(); }
@Test public void testOpen() throws Exception { server.start(() -> new TelnetHandler() { @Override protected void onOpen(TelnetConnection conn) { testComplete(); } }); client.connect("localhost", 4000); await(); }
private void testOptionValue(Supplier<TelnetHandler> factory, TelnetOptionHandler optionHandler) throws Exception { server.start(factory); client.setOptionHandler(optionHandler); client.connect("localhost", 4000); await(); }
private void testOptionValue(Supplier<TelnetHandler> factory, TelnetOptionHandler optionHandler) throws Exception { server.start(factory); client.setOptionHandler(optionHandler); client.connect("localhost", 4000); await(); }
@Test public void testServerClose() throws Exception { server.start(() -> new TelnetHandler() { @Override protected void onOpen(TelnetConnection conn) { conn.close(); } @Override protected void onClose() { testComplete(); } }); client.connect("localhost", 4000); await(); }
@Test public void testServerClose() throws Exception { server.start(() -> new TelnetHandler() { @Override protected void onOpen(TelnetConnection conn) { conn.close(); } @Override protected void onClose() { testComplete(); } }); client.connect("localhost", 4000); await(); }
@Test public void testOpen() throws Exception { server.start(new Supplier<TelnetHandler>() { @Override public TelnetHandler get() { return new TelnetHandler() { @Override protected void onOpen(TelnetConnection conn) { testComplete(); } }; } }); client.connect("localhost", 4000); await(); }
@Test public void testServerClose() throws Exception { server.start(new Supplier<TelnetHandler>() { @Override public TelnetHandler get() { return new TelnetHandler() { @Override protected void onOpen(TelnetConnection conn) { conn.close(); } @Override protected void onClose() { testComplete(); } }; } }); client.connect("localhost", 4000); await(); }
@Test public void testClientDisconnect() throws Exception { server.start(() -> new TelnetHandler() { @Override protected void onClose() { testComplete(); } }); try { client.connect("localhost", 4000); } finally { client.disconnect(); } await(); }
@Test public void testClientDisconnect() throws Exception { server.start(() -> new TelnetHandler() { @Override protected void onClose() { testComplete(); } }); try { client.connect("localhost", 4000); } finally { client.disconnect(); } await(); }
@Test public void testClientDisconnect() throws Exception { server.start(new Supplier<TelnetHandler>() { @Override public TelnetHandler get() { return new TelnetHandler() { @Override protected void onClose() { testComplete(); } }; } }); try { client.connect("localhost", 4000); } finally { client.disconnect(); } await(); }
final CountDownLatch latch1 = new CountDownLatch(1); final CountDownLatch latch2 = new CountDownLatch(1); server.start(new Supplier<TelnetHandler>() { @Override public TelnetHandler get() {
@Test public void testReceiveBinary() throws Exception { final CountDownLatch latch = new CountDownLatch(1); server.start(() -> new TelnetHandler() { @Override protected void onOpen(TelnetConnection conn) {
@Test public void testReceiveBinary() throws Exception { final CountDownLatch latch = new CountDownLatch(1); server.start(new Supplier<TelnetHandler>() { @Override public TelnetHandler get() {
@Test public void testReceiveBinary() throws Exception { final CountDownLatch latch = new CountDownLatch(1); server.start(() -> new TelnetHandler() { @Override protected void onOpen(TelnetConnection conn) {
@Test public void testReceive() throws Exception { server.start(() -> new TelnetHandler() { @Override protected void onData(byte[] data) { assertEquals(7, data.length); assertEquals((byte) 0, data[0]); assertEquals((byte) 1, data[1]); assertEquals((byte) 2, data[2]); assertEquals((byte) 3, data[3]); assertEquals((byte) 127, data[4]); assertEquals((byte) 0x80, data[5]); assertEquals((byte) 0x81, data[6]); testComplete(); } }); client.connect("localhost", 4000).write(new byte[]{0, 1, 2, 3, 127, (byte) 0x80, (byte) 0x81}).flush(); await(); }