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