I have a simple rmi-server and rmi-client. When i run this server and client in same network, my server function returns the result properly. But my server and client are in different networks and if the process time is more than 3-4 minutes client can not get the result, although server fihishes the operation.
here is my entire server code:
public class SimpleServer {
ServerRemoteObject mRemoteObject;
public static int RMIInPort = 27550;
public static int delay = 0;
public byte[] handleEvent(byte[] mMessage) throws Exception {
String request = new String(mMessage, "UTF-8");
// if ("hearthbeat".equalsIgnoreCase(request)) {
// System.out.println("returning for hearthbeat");
// return "hearthbeat response".getBytes("UTF-8");
// }
System.out.println(request);
Thread.sleep(delay);
System.out.println("returning response");
return "this is response".getBytes("UTF-8");
}
public void bindYourself(int rmiport) {
try {
mRemoteObject = new ServerRemoteObject(this);
java.rmi.registry.Registry iRegistry = LocateRegistry.getRegistry(rmiport);
iRegistry.rebind("Server", mRemoteObject);
} catch (Exception e) {
e.printStackTrace();
mRemoteObject = null;
}
}
public static void main(String[] server) {
int rmiport = Integer.parseInt(server[0]);
RMIInPort = Integer.parseInt(server[1]);
delay = Integer.parseInt(server[2]);
System.out.println("server java:" + System.getProperty("java.version"));
System.out.println("server started on:" + rmiport + "/" + RMIInPort);
System.out.println("server delay on:" + delay);
SimpleServer iServer = new SimpleServer();
iServer.bindYourself(rmiport);
while (true) {
try {
Thread.sleep(10000);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
and here is my client code:
public class SimpleClient {
ISimpleServer iServer;
public SimpleClient(String p_strServerIp, String p_strCMName, int nRMIPort) {
try {
if (nRMIPort == 1099) {
iServer = (ISimpleServer) Naming.lookup("rmi://" + p_strServerIp + "/" + p_strCMName);
} else {
Registry rmiRegistry = null;
rmiRegistry = LocateRegistry.getRegistry(p_strServerIp, nRMIPort);
iServer = (ISimpleServer) rmiRegistry.lookup(p_strCMName);
}
} catch (Exception ex) {
ex.printStackTrace();
iServer = null;
}
}
public static void main(String... strings) {
String ip = strings[0];
int rmiport = Integer.parseInt(strings[1]);
System.out.println("client java:" + System.getProperty("java.version"));
System.out.println("client is looking for:" + ip + ":" + rmiport);
SimpleClient iClient = new SimpleClient(ip, "Server", rmiport);
try {
byte[] response = iClient.iServer.doaction("this is request".getBytes("UTF-8"));
System.out.println(new String(response, "UTF-8"));
} catch (Exception e) {
e.printStackTrace();
}
}
}
and here is my rmi-registry code:
public class SimpleRMI implements Runnable {
Registry mRegistry = null;
public SimpleRMI(int nPort) {
try {
mRegistry = new sun.rmi.registry.RegistryImpl(nPort);
} catch (RemoteException e1) {
e1.printStackTrace();
}
}
#Override
public void run() {
while (true) {
try {
Thread.sleep(360000);
} catch (Exception e) {
e.printStackTrace();
}
}
}
public static void main(String... strings) {
int rmiport = Integer.parseInt(strings[0]);
System.out.println("rmi java:" + System.getProperty("java.version"));
System.out.println("rmi started on:" + rmiport);
SimpleRMI iRegisry = new SimpleRMI(rmiport);
Thread tThread = new Thread(iRegisry);
tThread.start();
byte[] bytes = new byte[1];
while (true) {
try {
System.in.read(bytes);
if (bytes[0] == 13) {
try {
iRegisry.listRegistry();
} catch (Exception exc2) {
exc2.printStackTrace();
}
}
} catch (Exception exc) {
exc.printStackTrace();
}
}
}
private void listRegistry() {
String[] strList = null;
try {
strList = mRegistry.list();
if (strList != null) {
for (int i = 0; i < strList.length; i++) {
int j = i + 1;
String name = strList[i];
java.rmi.Remote r = mRegistry.lookup(name);
System.out.println(j + ". " + strList[i] + " -> "
+ r.toString());
}
}
System.out.println();
} catch (Exception exc) {
exc.printStackTrace();
}
}
}
and my remote interface and remote object:
public interface ISimpleServer extends java.rmi.Remote {
public byte[] doaction(byte[] message) throws java.rmi.RemoteException;
}
#SuppressWarnings("serial")
public class ServerRemoteObject extends UnicastRemoteObject implements ISimpleServer {
SimpleServer Server = null;
public ServerRemoteObject(SimpleServer pServer) throws RemoteException {
super(SimpleServer.RMIInPort);
Server = pServer;
}
#Override
public byte[] doaction(byte[] message) throws RemoteException {
try {
return Server.handleEvent(message);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
when i run client and server in different networks. (i run client in my home network) and if delay is more than 3-4 mins server prints returning response but client still waits for the response. If delay is only 1 minute, clients gets the result properly.
Can you please help me to find where the problem is?
Related
I'm trying to create an object in one class then use that object in another class but each time I try to use it it just says the value is null
Customer cus = new Customer();
ServerSocket s = null;
public AddCustomer() {
}
public void getCustomerDetail() {
String back = " ";
{
try {
s = new ServerSocket(5433);
} catch (IOException e) {
System.out.println("Error:" + e.getMessage());
System.exit(0);
}
while (back.equals(" ")) {
try {
Socket s1 = s.accept();
System.out.println("Connection established at port 5433");
InputStream is = s1.getInputStream();
ObjectInputStream dis = new ObjectInputStream(is);
System.out.println("Getting data...");
cus = (Customer)dis.readObject();
System.out.println(cus.toString());
System.out.println(cus.getName());
dis.close();
s1.close();
System.out.println("Connection closed.");
} catch (ConnectException connExcep) {
System.out.println("1Error: " + connExcep.getMessage());
} catch (IOException ioExcep) {
System.out.println("2Error: " + ioExcep.getMessage());
} catch (Exception e) {
System.out.println("3Error: " + e.getMessage());
}
new AddCustomer().addCustomerToDB();
}
}
}
public void addCustomerToDB() {
System.out.println("start ");
Connection connection = null;
Statement statement = null;
int check = 1;
System.out.println(cus.getName()+"dadawd");
}
When I print out the value of cus.getName() it just gives me null but when I print it out in getCustomerDetail it gives me the correct value.
dis.readObject returns an object with the values in it.
Depends on what you are doing in the getName function and in the constructor.
Maybe in getCustomerDetails() you are setting the values in the input stream. But the default constructor doesn't do anything with name variable.
It looks like the issue of packaging. Try below code.
public class AddCustomer {
public static void main(String[] args) {
new AddCustomer().getCustomerDetail();
}
Customer cus = new Customer();
public void getCustomerDetail() {
String back = " ";
{
while (back.equals(" ")) {
try {
System.out.println(cus.toString());
System.out.println(cus.getName());
System.out.println("Connection closed.");
} catch (Exception e) {
System.out.println("3Error: " + e.getMessage());
}
new AddCustomer().addCustomerToDB();
break;
}
}
}
public void addCustomerToDB() {
System.out.println(cus.getName()+"dadawd");
}
}
class Customer{
private String name="ABC";
String getName() {
return name;
}
}
We found here one issue you have to create "Customer cus = new Customer();" this object under main() function like as
public class AddCustomer {
public static void main(String[] args) {
Customer cus = new Customer();
new AddCustomer().getCustomerDetail();
}
I can send data in python and received in server, but after sleep more than 1ms(if do some For-loops(E.g: for i in range(0, 60):
print i), the result is same), I use socket to send data, but can't be received in java server.
There are code:
A client is writen in python2:
address = ('127.0.0.1', 9898)
ccc = socket(AF_INET, SOCK_STREAM)
ccc.connect(address)
ccc.send("client" + str(1) + ":before time.sleep send1111\n")
time.sleep(0.001)
ccc.send("client2:222222 after time.sleep\n")# if sleep 0.0009,can received,but 0.001 can't
A server is written in java:
ReceiveListener listener = new ReceiveListener() {
#Override
public void onReceived(int clientId, String msg) {
System.out.println(clientId + ":" + msg);
}
};
ClientManager clientManager = ClientManager.getInstance(listener, 9898);
clientManager.start();
And this is class manage the client:
public class ClientManager {
private static ServerThread serverThread = null;
private static ClientManager instance = null;
private final int port;
private ReceiveListener receiveListener = null;
private ClientManager(ReceiveListener receiveListener, int port) {
this.receiveListener = receiveListener;
this.port = port;
serverThread = new ServerThread(receiveListener, port);
}
public static ClientManager getInstance(ReceiveListener receiveListener, int port) {
if (instance == null) {
synchronized (ClientManager.class) {
if (instance == null) {
instance = new ClientManager(receiveListener, port);
}
}
}
return instance;
}
public void stop() {
serverThread.Stop();
serverThread = null;
}
public void start() {
if (serverThread == null) {
serverThread = new ServerThread(receiveListener, port);
}
new Thread(serverThread).start();
}
public static class ServerThread implements Runnable {
private ReceiveListener receiveListener;
private static Map<Integer, HandleMsgTask> tasks = new HashMap<>();
private final AtomicBoolean isExit = new AtomicBoolean(false);
private ServerSocket server;
int i = 0;
public ServerThread(ReceiveListener receiveListener, int port) {
try {
this.receiveListener = receiveListener;
this.server = new ServerSocket(port);
} catch (IOException e) {
System.out.println("failed:" + e.getMessage());
}
}
#Override
public void run() {
try {
while (!isExit.get()) {
System.out.println("wait devices... ... " + i);
Socket client = server.accept();
HandleMsgTask task = new HandleMsgTask(i, client, receiveListener);
new Thread(task).start();
tasks.put(i, task);
i++;
System.out.println("No:" + i);
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static class HandleMsgTask implements Runnable {
public final int clientId;
public final Socket client;
public static boolean connectStop = false;
private final ReceiveListener ReceiveListener;
public HandleMsgTask(int i, Socket client, ReceiveListener ReceiveListener) {
this.clientId = i;
this.client = client;
this.ReceiveListener = ReceiveListener;
}
public void disconnectClient() {
connectStop = true;
try {
client.close();
} catch (IOException e) {
e.printStackTrace();
}
}
#Override
public void run() {
try {
final String address = client.getRemoteSocketAddress().toString();
System.out.println(clientId + ":" + address);
InputStream inputStream = client.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
while (reader.ready() && !connectStop) {
String line = reader.readLine();
if (ReceiveListener != null) {
ReceiveListener.onReceived(clientId, line);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
public void Stop() {
if (tasks != null) {
for (HandleMsgTask task : tasks.values()) {
task.disconnectClient();
}
tasks.clear();
}
isExit.set(true);
if (server != null) {
try {
server.close();
System.out.println("close server");
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
Could someone help me? Thanks!
As user207421 said,I misused ready(); I Change the code bellow and solve the problem:
edit:
while (!bIsStopped.get() && ((line = reader.readLine()) != null)) {
if (newMsgRecListener != null) {
newMsgRecListener.onMsgRec(clientId, line);
}
}
This is the piece of code I am facing issues with. When the post construct gets called..the source gets set .. But when I receive a message from server and the processBinaryMessage method gets called..the source turns out to be null.
I don't understand the problem...Any help is appreciated..
#ClientEndpoint
#Component
public class MyClientEndpoint {
#Inject
private Source Source;
private boolean postConstructCalled = false;
#PostConstruct
public void init() {
postConstructCalled = true;
System.out.println("Post construct called ... ");
}
#OnOpen
public void onOpen(Session session) {
System.out.println("Connected to endpoint: " + session.getBasicRemote());
SessionUtil.setSession(session);
try {
System.out.println("Checking the established connection........");
session.getBasicRemote().sendText("Checking the connection...");
} catch (IOException ex) {
Logger.getLogger(MyClientEndpoint.class.getName()).log(Level.SEVERE, null, ex);
}
}
#OnMessage
public void processMessage(String message) {
System.out.println("Received string message in client: " + message);
}
#OnMessage
public void processBinaryMessage(byte[] bytes) {
ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
byte[] type = new byte[3];
byteBuffer.get(type);
String msgType = new String(type);
//System.out.println("Read type : " + msgType);
if(msgType.compareTo("MAX") == 0) {
int maxLimit = byteBuffer.getInt();
System.out.println("Read max blocks : " + maxLimit);
ClientDataTransfer.setMaxTransferLimit(maxLimit);
}
else if(msgType.compareTo("NXT") == 0) {
ClientDataTransfer.incMaxTransferLimit();
}
else if(msgType.compareTo("MAP") == 0) {
int length = byteBuffer.getInt();
byte[] data = new byte[length];
byteBuffer.get(data);
source.getClientDataTransfer().addToDataRequestQueue(data);
}
}
#OnError
public void processError(Throwable t) {
t.printStackTrace();
}
#OnClose
public void onClose(Session session) {
try {
session.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("Closing connection to endpoint: " + session.getBasicRemote());
}
}
Thanks,
Sreeja
I am trying to run the below code I am getting EOFException. The below is my output
Connected to ssl://REMOVED.messaging.internetofthings.ibmcloud.com:8883
.deliveryComplete() entered
Data published on topic iot-2/type/loradevice/id/cdef1234/cmd/cid/fmt/json and the msg is{"count":0,"cmd":"reset","time":"2017-01-25 18:38:34"}
connection true
Connection lost (32109) - java.io.EOFException
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:146)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:267)
at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:65)
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:107)
... 1 more
The code is below
package com.ibm.bluemixmqtt;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.json.JSONException;
import org.apache.commons.json.JSONObject;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.MqttPersistenceException;
public class AppTest2
{
private MqttHandler1 handler;
/**
* #param args
*/
public static void main(String[] args)
{
new AppTest2().doApp();
}
/**
* Run the app
*/
public void doApp()
{
// Read properties from the conf file
Properties props = MqttUtil.readProperties("Mydata\\app.conf");
String org = "REMOVED";
String id = "REMOVED";
String authmethod = "REMOVED";
String authtoken = "REMOVED";
// isSSL property
String sslStr = props.getProperty("isSSL");
boolean isSSL = false;
if (sslStr.equals("T")) {
isSSL = true;
}
System.out.println("org: " + org);
System.out.println("id: " + id);
System.out.println("authmethod: " + authmethod);
System.out.println("authtoken" + authtoken);
System.out.println("isSSL: " + isSSL);
// Format: a:<orgid>:<app-id>
String clientId = "a:" + org + ":" + id;
String serverHost = org + MqttUtil.SERVER_SUFFIX;
handler = new MqttHandler1();
handler.connect(serverHost, clientId, authmethod, authtoken, isSSL);
publish();
}
public void publish(){
JSONObject jsonObj = new JSONObject();
String deviceid = "cdef1234";
try {
jsonObj.put("cmd", "reset");
jsonObj.put("count", 0);
jsonObj.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
} catch (JSONException e) {
e.printStackTrace();
}
handler.publish(
"iot-2/type/" + MqttUtil.DEFAULT_DEVICE_TYPE + "/id/" + deviceid + "/cmd/" + MqttUtil.DEFAULT_CMD_ID + "/fmt/json",
jsonObj.toString(), false, 0);
}
}
class MqttHandler1 implements MqttCallback
{
private final static String DEFAULT_TCP_PORT = "1883";
private final static String DEFAULT_SSL_PORT = "8883";
private MqttClient client = null;
public MqttHandler1()
{
}
#Override
public void connectionLost(Throwable throwable)
{
if (throwable != null) {
System.out.println("Error3");
throwable.printStackTrace();
}
}
#Override
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken)
{
System.out.println(".deliveryComplete() entered");
}
#Override
public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception
{
String payload = new String(mqttMessage.getPayload());
System.out.println(".messageArrived - Message received on topic " + topic + ": message is " + payload);
}
public void connect(String serverHost, String clientId, String authmethod, String authtoken, boolean isSSL)
{
// check if client is already connected
if (!isMqttConnected()) {
String connectionUri = null;
// tcp://<org-id>.messaging.internetofthings.ibmcloud.com:1883
// ssl://<org-id>.messaging.internetofthings.ibmcloud.com:8883
if (isSSL) {
connectionUri = "ssl://" + serverHost + ":" + DEFAULT_SSL_PORT;
} else {
connectionUri = "tcp://" + serverHost + ":" + DEFAULT_TCP_PORT;
}
if (client != null) {
try {
client.disconnect();
} catch (MqttException e) {
e.printStackTrace();
}
client = null;
}
try {
client = new MqttClient(connectionUri, clientId);
} catch (MqttException e) {
e.printStackTrace();
}
client.setCallback(this);
// create MqttConnectOptions and set the clean session flag
MqttConnectOptions options = new MqttConnectOptions();
options.setCleanSession(true);
options.setUserName(authmethod);
options.setPassword(authtoken.toCharArray());
options.setKeepAliveInterval(2000);
// If SSL is used, do not forget to use TLSv1.2
if (isSSL) {
java.util.Properties sslClientProps = new java.util.Properties();
sslClientProps.setProperty("com.ibm.ssl.protocol", "TLSv1.2");
options.setSSLProperties(sslClientProps);
}
try {
// connect
client.connect(options);
System.out.println("Connected to " + connectionUri);
} catch (MqttException e) {
e.printStackTrace();
}
}
}
public void disconnect()
{
// check if client is actually connected
if (isMqttConnected()) {
try {
// disconnect
client.disconnect();
} catch (MqttException e) {
e.printStackTrace();
}
}
}
public void subscribe(String topic, int qos)
{
// check if client is connected
if (isMqttConnected()) {
try {
client.subscribe(topic, qos);
System.out.println("Subscribed: " + topic);
} catch (MqttException e) {
e.printStackTrace();
}
} else {
connectionLost(null);
}
}
public void unsubscribe(String topic)
{
// check if client is connected
if (isMqttConnected()) {
try {
client.unsubscribe(topic);
} catch (MqttException e) {
e.printStackTrace();
}
} else {
connectionLost(null);
}
}
public void publish(String topic, String message, boolean retained, int qos)
{
// check if client is connected
if (isMqttConnected()) {
// create a new MqttMessage from the message string
MqttMessage mqttMsg = new MqttMessage(message.getBytes());
// set retained flag
mqttMsg.setRetained(retained);
// set quality of service
mqttMsg.setQos(qos);
try {
client.publish(topic, mqttMsg);
System.out.println("Data published on topic " + topic + " and the msg is" + mqttMsg);
System.out.println("connection "+client.isConnected());
} catch (MqttPersistenceException e) {
System.out.println("Error1");
e.printStackTrace();
} catch (MqttException e) {
System.out.println("Error1");
e.printStackTrace();
}
} else {
connectionLost(null);
}
}
private boolean isMqttConnected()
{
boolean connected = false;
try {
if ((client != null) && (client.isConnected())) {
connected = true;
}
} catch (Exception e) {
// swallowing the exception as it means the client is not connected
}
return connected;
}
}
Any one help me on this.
Thanks in adavance.
the EOFException might indicates that the clientID is reused and the access is blocked... make sure that you only call once the connect method... possibly use only the SSL or non-SSL connection sequence
I have written a mqtt client using paho mqttv3
This is the code for the client:
public class MQTT_Client {
private MqttClient mqtt;
private MqttConnectOptions conOpt;
private static Logger log = Logger.getRootLogger();
private String topicFilter;
private int connectionTimeout = 30;
public MQTT_Client(String brokerUrl) {
this.topicFilter = "/bmpiips/+/hb/out";
try {
String clientId = "HBA";
mqtt = new MqttClient(brokerUrl, clientId, new MemoryPersistence());
log.info("Connecting to " + brokerUrl + " with client ID " + mqtt.getClientId());
conOpt = new MqttConnectOptions();
conOpt.setCleanSession(true);
mqtt.setCallback(new MQTT_Callback(this));
} catch (MqttException e) {
log.error(null, e);
}
}
public void start() {
reconnect();
try {
subscribe(topicFilter, 1);
} catch (MqttException e) {
log.warn("Unable to subscribe to " + topicFilter);
}
}
private void connect() throws MqttSecurityException, MqttException {
if (mqtt.isConnected() == false) {
mqtt.connect(conOpt);
if (mqtt.isConnected() == true) {
log.info("Connected to MQTT Broker.");
}
}
}
public boolean isConnected() {
return mqtt.isConnected();
}
public boolean publish(String topicName, byte[] payload, int qos) {
try {
MqttTopic topic = mqtt.getTopic(topicName);
MqttMessage message = new MqttMessage(payload);
message.setQos(qos);
log.info("Publishing to topic: \"" + topicName + "\" Message size: " + payload.length + " bytes");
MqttDeliveryToken token = topic.publish(message);
token.waitForCompletion();
return true;
} catch (MqttException e) {
log.error(null, e);
return false;
}
}
public void subscribe(String topicName, int qos) throws MqttSecurityException, MqttException {
mqtt.subscribe(topicName, qos);
log.info("Subscribed to topic \"" + topicName + "\"");
}
public void reconnect() {
if (mqtt.isConnected() == false) {
try {
connect();
} catch (MqttSecurityException e) {
log.error("Coud not reconnect...", e);
} catch (MqttException e) {
log.error("Coud not reconnect...", e);
}
} else {
log.error("Allready connected...");
}
}
public void disconnect() throws MqttException {
mqtt.disconnect();
while (mqtt.isConnected()) {
// wait for disconnection
}
if (mqtt.isConnected() == false) {
log.info("Disconnected from the MQTT Broker.");
}
}
public String getTopicFilter() {
return topicFilter;
}
public int getConnectionTimeout() {
return connectionTimeout;
}
}
and this is the code for the callback class:
public class MQTT_Callback implements MqttCallback {
private static Logger log = Logger.getRootLogger();
private static MQTT_ThreadPool threadPool = new MQTT_ThreadPool();
private final MQTT_Client mqtt;
public MQTT_Callback(MQTT_Client mqtt) {
this.mqtt = mqtt;
}
#Override
public void connectionLost(Throwable cause) {
log.error("Disconnected from MqttBroker", cause);
while (mqtt.isConnected() == false) {
try {
log.info("Sleeping for : " + mqtt.getConnectionTimeout() + " seconds...");
Thread.sleep(mqtt.getConnectionTimeout() * 1000);
} catch (InterruptedException e) {
log.error("Coud not sleep...");
}
mqtt.reconnect();
try {
mqtt.subscribe(mqtt.getTopicFilter(), 1);
} catch (MqttException e) {
log.error(e);
}
}
}
#Override
public void deliveryComplete(MqttDeliveryToken token) {
log.info("Message delivered successfully");
}
#Override
public void messageArrived(MqttTopic topic, MqttMessage message) throws Exception {
log.info("Message received from topic: " + topic.getName() + " Message size: " + message.getPayload().length
+ " bytes");
threadPool.execute(topic, message);
}
}
It works ok but from time to time I get a weird exception that kills the connection:
2013-07-09 10:36:05.959 ERROR root:23 - Disconnected from MqttBroker
Connection lost (32109) - java.io.EOFException
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:119)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(Unknown Source)
at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:51)
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:86)
... 1 more
If anyone has ever come across this please give me some tips.