This commit is contained in:
crusader 2018-05-04 17:09:11 +09:00
parent d0ade4b90f
commit 76bbb882fa

View File

@ -1,6 +1,7 @@
package com.loafle.commons.server.websocket.client; package com.loafle.commons.server.websocket.client;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.net.URI;
import java.util.List; import java.util.List;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -31,7 +32,7 @@ public class Client {
public static final String CHANNEL_CLASS = "CLIENT_CHANNEL_CLASS"; public static final String CHANNEL_CLASS = "CLIENT_CHANNEL_CLASS";
public static final String CHANNEL_HANDLERS = "CLIENT_CHANNEL_HANDLERS"; public static final String CHANNEL_HANDLERS = "CLIENT_CHANNEL_HANDLERS";
public static final String HANDSHAKER = "CLIENT_HANDSHAKER"; public static final String HANDSHAKER = "CLIENT_HANDSHAKER";
public static final String SOCKET_ADDRESS = "CLIENT_SOCKET_ADDRESS"; public static final String SERVER_URI = "CLIENT_SERVER_URI";
@Autowired @Autowired
@Qualifier(CHANNEL_CLASS) @Qualifier(CHANNEL_CLASS)
@ -43,8 +44,8 @@ public class Client {
@Qualifier(HANDSHAKER) @Qualifier(HANDSHAKER)
WebSocketClientHandshaker handshaker; WebSocketClientHandshaker handshaker;
@Autowired @Autowired
@Qualifier(SOCKET_ADDRESS) @Qualifier(SERVER_URI)
protected SocketAddress address; protected URI serverURI;
private Channel channel; private Channel channel;
@ -75,7 +76,7 @@ public class Client {
}); });
this.init(); this.init();
ChannelFuture cf = b.connect(this.address); ChannelFuture cf = b.connect(serverURI.getHost(), serverURI.getPort());
this.onStart(); this.onStart();
cf.sync(); cf.sync();