conOpts.setCleanSession(true);
conOpts.setKeepAliveInterval(60);
}
public void testConnectFirst() throws MqttException, IOException, InterruptedException {
NetworkModule networkModule = new TCPNetworkModule(SocketFactory.getDefault(), host, port, "");
networkModule.start();
MqttInputStream mqttIn = new MqttInputStream (networkModule.getInputStream());
MqttOutputStream mqttOut = new MqttOutputStream(networkModule.getOutputStream());
try {
mqttOut.write(new MqttPingReq());
mqttOut.flush();
mqttIn.readMqttWireMessage();
fail("Error expected if CONNECT is not first packet");