channel.connect(target);
System.err.println(channel);
CoapEncoder encoder = new CoapEncoder();
CoapDecoder decoder = new CoapDecoder();
ByteBuffer buff = ByteBuffer.allocateDirect(2048);
Random r = new Random();
byte[] url = "nlp".getBytes();
CoapMessage msg = new CoapMessage(1, MessageType.CONFIRMABLE, CoapCode.GET.getCode(), 1234, null,
new CoapOption[] { new CoapOption(CoapOptionType.URI_PATH, url) }, null);
for (int j = 0; j < 8; j++) {
long start = System.currentTimeMillis();
final int count = 100000;
for (int i = 0; i < count; i++) {
buff.position(0);
buff.limit(buff.capacity());
int id = r.nextInt(1024);
msg.setId(id);
int bytes = channel.send(encoder.encode(msg, null), target);
if (bytes < 1) {
System.err.println("write fail :/ " + bytes);
} else {
buff.position(0);