Rearchitected the broker, switching from ProtocolProcessor and publisher to MQTTConnection, Session and PostOffice

This commit is contained in:
andsel
2018-11-02 12:33:59 +01:00
parent 0ad6ffdd3c
commit a2266e5bbe
60 changed files with 5225 additions and 1025 deletions
@@ -20,10 +20,19 @@ import io.netty.buffer.ByteBuf;
import java.nio.charset.StandardCharsets;
final class DebugUtils {
public final class DebugUtils {
static String payload2Str(ByteBuf content) {
return new String(content.copy().array(), StandardCharsets.UTF_8);
public static String payload2Str(ByteBuf content) {
final ByteBuf copy = content.copy();
final byte[] bytesContent;
if (copy.isDirect()) {
final int size = copy.readableBytes();
bytesContent = new byte[size];
copy.readBytes(bytesContent);
} else {
bytesContent = copy.array();
}
return new String(bytesContent, StandardCharsets.UTF_8);
}
private DebugUtils() {