我需要使用 AWS Web Socket API Gateway 在本地测试我的函数。有没有可能在我的本地机器上模仿或复制 AWS Web Socket 行为的方法?所以我不需要为我的 Lambda 函数部署每一个小改动
谢谢
我试图通过telnet与Windows服务器中的应用程序进行交互,所以我使用的是TelnetClient()方法.我可以使用System.in.read()进行交互(发送命令和检索结果),但是我希望这个程序能够在不使用任何键盘输入的情况下自动运行.所以,我的问题是,为什么System.in.read()工作,但ByteArrayInputStream不工作?
到目前为止这是我的代码:
public class telnetExample2 implements Runnable, TelnetNotificationHandler{
static TelnetClient tc = null;
public static void main (String args[]) throws IOException, InterruptedException{
tc = new TelnetClient();
while (true){
try{
tc.connect("192.168.1.13", 8999);
}
catch (SocketException ex){
Logger.getLogger(telnetExample2.class.getName()).log(Level.SEVERE, null,ex);
}
Thread reader = new Thread(new telnetExample2());
tc.registerNotifHandler(new telnetExample2());
String command = "getversion"; //this is the command i would like to write
OutputStream os = tc.getOutputStream();
InputStream is = new ByteArrayInputStream(command.getBytes("UTF-8")); //i'm using UTF-8 charset encoding here
byte[] buff = new byte[1024];
int …Run Code Online (Sandbox Code Playgroud)