broker/RawClient: code formatter used
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
package io.moquette.testclient;
|
package io.moquette.testclient;
|
||||||
|
|
||||||
import io.netty.bootstrap.Bootstrap;
|
import io.netty.bootstrap.Bootstrap;
|
||||||
@@ -11,15 +12,14 @@ import io.netty.util.ReferenceCountUtil;
|
|||||||
import io.moquette.Utils;
|
import io.moquette.Utils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.Semaphore;
|
import java.util.concurrent.Semaphore;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is used to have a fluent interface to interact with a server.
|
* This class is used to have a fluent interface to interact with a server. Inspired by
|
||||||
* Inspired by org.kaazing.robot
|
* org.kaazing.robot
|
||||||
*/
|
*/
|
||||||
public class RawClient {
|
public class RawClient {
|
||||||
|
|
||||||
@@ -71,6 +71,7 @@ public class RawClient {
|
|||||||
b.channel(NioSocketChannel.class);
|
b.channel(NioSocketChannel.class);
|
||||||
b.option(ChannelOption.SO_KEEPALIVE, true);
|
b.option(ChannelOption.SO_KEEPALIVE, true);
|
||||||
b.handler(new ChannelInitializer<SocketChannel>() {
|
b.handler(new ChannelInitializer<SocketChannel>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initChannel(SocketChannel ch) throws Exception {
|
public void initChannel(SocketChannel ch) throws Exception {
|
||||||
ChannelPipeline pipeline = ch.pipeline();
|
ChannelPipeline pipeline = ch.pipeline();
|
||||||
@@ -117,7 +118,7 @@ public class RawClient {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Write just String bytes not length
|
* Write just String bytes not length
|
||||||
* */
|
*/
|
||||||
public RawClient write(String str) {
|
public RawClient write(String str) {
|
||||||
ByteBuf out = Unpooled.buffer(str.length());
|
ByteBuf out = Unpooled.buffer(str.length());
|
||||||
byte[] raw;
|
byte[] raw;
|
||||||
@@ -153,14 +154,14 @@ public class RawClient {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Expect the closing of the underling channel, with timeout
|
* Expect the closing of the underling channel, with timeout
|
||||||
* */
|
*/
|
||||||
public void closed(long timeout) throws InterruptedException {
|
public void closed(long timeout) throws InterruptedException {
|
||||||
disconnectLatch.await(timeout, TimeUnit.MILLISECONDS);
|
disconnectLatch.await(timeout, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expect closing the connect with unbound time
|
* Expect closing the connect with unbound time
|
||||||
* */
|
*/
|
||||||
public void closed() throws InterruptedException {
|
public void closed() throws InterruptedException {
|
||||||
disconnectLatch.await();
|
disconnectLatch.await();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user