ing
This commit is contained in:
parent
5091e0fa6a
commit
d0ade4b90f
|
@ -1,6 +1,7 @@
|
|||
package com.loafle.commons.server.websocket.client;
|
||||
|
||||
import java.net.SocketAddress;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -28,7 +29,7 @@ import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketCl
|
|||
public class Client {
|
||||
private static final Logger logger = LoggerFactory.getLogger(Client.class);
|
||||
public static final String CHANNEL_CLASS = "CLIENT_CHANNEL_CLASS";
|
||||
public static final String CHANNEL_HANDLER = "CLIENT_CHANNEL_HANDLER";
|
||||
public static final String CHANNEL_HANDLERS = "CLIENT_CHANNEL_HANDLERS";
|
||||
public static final String HANDSHAKER = "CLIENT_HANDSHAKER";
|
||||
public static final String SOCKET_ADDRESS = "CLIENT_SOCKET_ADDRESS";
|
||||
|
||||
|
@ -36,8 +37,8 @@ public class Client {
|
|||
@Qualifier(CHANNEL_CLASS)
|
||||
protected Class<? extends Channel> channelClass;
|
||||
@Autowired
|
||||
@Qualifier(CHANNEL_HANDLER)
|
||||
protected ChannelHandler handler;
|
||||
@Qualifier(CHANNEL_HANDLERS)
|
||||
protected List<ChannelHandler> handlers;
|
||||
@Autowired
|
||||
@Qualifier(HANDSHAKER)
|
||||
WebSocketClientHandshaker handshaker;
|
||||
|
@ -63,9 +64,13 @@ public class Client {
|
|||
new HttpClientCodec(),
|
||||
new HttpObjectAggregator(8192),
|
||||
WebSocketClientCompressionHandler.INSTANCE,
|
||||
new WebSocketClientProtocolHandler(handshaker, true),
|
||||
handler
|
||||
new WebSocketClientProtocolHandler(handshaker, true)
|
||||
);
|
||||
if (null != handlers) {
|
||||
for (ChannelHandler handler : handlers) {
|
||||
p.addLast(handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user