用jdk8语法修改

master
星期八 5 years ago
parent d669be0a8e
commit 7e94538ffd
  1. 5
      .gitignore
  2. 2
      pom.xml
  3. 12
      proxy-client/src/main/java/org/fengfei/lanproxy/client/ProxyClientContainer.java

5
.gitignore vendored

@ -4,7 +4,12 @@
# Mobile Tools for Java (J2ME) # Mobile Tools for Java (J2ME)
.mtj.tmp/ .mtj.tmp/
#Idea Files #
*.iml
.idea
# Package Files # # Package Files #
*.jar *.jar
*.war *.war
*.ear *.ear

@ -17,7 +17,7 @@
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-all</artifactId> <artifactId>netty-all</artifactId>
<version>4.0.36.Final</version> <version>4.1.12.Final</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>

@ -102,13 +102,8 @@ public class ProxyClientContainer implements Container, ChannelStatusListener {
} }
private void connectProxyServer() { private void connectProxyServer() {
bootstrap.connect(config.getStringValue("server.host"), config.getIntValue("server.port")).addListener((ChannelFuture future)->{
bootstrap.connect(config.getStringValue("server.host"), config.getIntValue("server.port")).addListener(new ChannelFutureListener() { if (future.isSuccess()){
@Override
public void operationComplete(ChannelFuture future) throws Exception {
if (future.isSuccess()) {
// 连接成功,向服务器发送客户端认证信息(clientKey) // 连接成功,向服务器发送客户端认证信息(clientKey)
ClientChannelMannager.setCmdChannel(future.channel()); ClientChannelMannager.setCmdChannel(future.channel());
ProxyMessage proxyMessage = new ProxyMessage(); ProxyMessage proxyMessage = new ProxyMessage();
@ -117,14 +112,13 @@ public class ProxyClientContainer implements Container, ChannelStatusListener {
future.channel().writeAndFlush(proxyMessage); future.channel().writeAndFlush(proxyMessage);
sleepTimeMill = 1000; sleepTimeMill = 1000;
logger.info("connect proxy server success, {}", future.channel()); logger.info("connect proxy server success, {}", future.channel());
} else { }else {
logger.warn("connect proxy server failed", future.cause()); logger.warn("connect proxy server failed", future.cause());
// 连接失败,发起重连 // 连接失败,发起重连
reconnectWait(); reconnectWait();
connectProxyServer(); connectProxyServer();
} }
}
}); });
} }

Loading…
Cancel
Save