broker/RawClient: code formatter used

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