-// }
-// } finally {
-// toOriginalTerminal();
-// }
-// }
-//
-// private static Optional<String> readSocketMessage(SocketChannel channel) throws IOException {
-// ByteBuffer buffer = ByteBuffer.allocate(1024);
-// int bytesRead = channel.read(buffer);
-// if (bytesRead < 0)
-// return Optional.empty();
-//
-// byte[] bytes = new byte[bytesRead];
-// buffer.flip();
-// buffer.get(bytes);
-// String message = new String(bytes);
-// return Optional.of(message);
-// }
-//
-// public static void setupConnection(Selector selector, SocketChannel client) throws IOException {
-// // Connect to the remote server
-// SocketAddress address = new InetSocketAddress("192.168.1.74", 8000);
-// SocketChannel remote = SocketChannel.open(address);
-//
-// // Make sockets non-blocking (should be better performance)
-// client.configureBlocking(false);
-// remote.configureBlocking(false);
-//
-// client.register(selector, SelectionKey.OP_READ, remote);
-// remote.register(selector, SelectionKey.OP_READ, client);
-// }
-//
-// static UnixDomainSocketAddress ioSocketAddress() throws IOException {
-// String system = "default";
-// String bundleSn = "org.argeo.slc.jshell";
-//
-// String xdgRunDir = System.getenv("XDG_RUNTIME_DIR");
-// Path baseRunDir = Paths.get(xdgRunDir);
-// Path jshellSocketBase = baseRunDir.resolve("jshell").resolve(system).resolve(bundleSn);
-//
-// Files.createDirectories(jshellSocketBase);
-//
-// Path ioSocketPath = jshellSocketBase.resolve("io");
-//
-// UnixDomainSocketAddress ioSocketAddress = UnixDomainSocketAddress.of(ioSocketPath);
-// System.out.println(ioSocketAddress);
-// return ioSocketAddress;
-// }