/
NettyClientTest.java
41 lines (26 loc) · 1.01 KB
/
NettyClientTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.shinemo.mpush.core.netty;
import java.util.concurrent.locks.LockSupport;
import io.netty.channel.ChannelHandler;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.shinemo.mpush.api.Client;
import com.shinemo.mpush.netty.client.NettyClientFactory;
/**
* Created by ohun on 2015/12/24.
*/
public class NettyClientTest {
private static final Logger log = LoggerFactory.getLogger(NettyClientTest.class);
private String host = "127.0.0.1";
private int port = 3000;
private ChannelHandler handler = new ClientHandler();
@Test
public void testClient() throws Exception {
Client client = NettyClientFactory.instance.get(host, port, handler);
LockSupport.park();
client.close("");
log.error(ToStringBuilder.reflectionToString(client, ToStringStyle.MULTI_LINE_STYLE));
}
}