diff --git a/core/src/main/java/com/taobao/arthas/core/server/ArthasBootstrap.java b/core/src/main/java/com/taobao/arthas/core/server/ArthasBootstrap.java index 2661bdac..e0e439ea 100644 --- a/core/src/main/java/com/taobao/arthas/core/server/ArthasBootstrap.java +++ b/core/src/main/java/com/taobao/arthas/core/server/ArthasBootstrap.java @@ -85,10 +85,18 @@ public class ArthasBootstrap { List resolvers = new ArrayList(); resolvers.add(builtinCommands); // TODO: discover user provided command resolver - shellServer.registerTermServer(new TelnetTermServer( - configure.getIp(), configure.getTelnetPort(), options.getConnectionTimeout())); - shellServer.registerTermServer(new HttpTermServer( - configure.getIp(), configure.getHttpPort(), options.getConnectionTimeout())); + if (configure.getTelnetPort() > 0) { + shellServer.registerTermServer(new TelnetTermServer(configure.getIp(), configure.getTelnetPort(), + options.getConnectionTimeout())); + } else { + logger.info("telnet port is {}, skip bind telnet server.", configure.getTelnetPort()); + } + if (configure.getHttpPort() > 0) { + shellServer.registerTermServer(new HttpTermServer(configure.getIp(), configure.getHttpPort(), + options.getConnectionTimeout())); + } else { + logger.info("http port is {}, skip bind http server.", configure.getHttpPort()); + } for (CommandResolver resolver : resolvers) { shellServer.registerCommandResolver(resolver);