// Path: src/main/java/net/eusashead/iot/mqtt/MqttMessage.java
// public interface MqttMessage {
// 
//     boolean isRetained();
// 
//     int getQos();
// 
//     byte[] getPayload();
// 
// }
// 
// Path: src/main/java/net/eusashead/iot/mqtt/PublishToken.java
// public interface PublishToken extends MqttToken {
// 
// }


import io.reactivex.SingleEmitter;
import net.eusashead.iot.mqtt.MqttMessage;
import java.util.Objects;
import net.eusashead.iot.mqtt.PublishToken;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.eclipse.paho.client.mqttv3.IMqttAsyncClient;
import org.eclipse.paho.client.mqttv3.IMqttToken;
import org.eclipse.paho.client.mqttv3.MqttException;
import io.reactivex.Single;
                @Override
                public String getClientId() {
                    return mqttToken.getClient().getClientId();
                }

                @Override
                public String[] getTopics() {
                    return mqttToken.getTopics();
                }

                @Override
                public int getMessageId() {
                    return mqttToken.getMessageId();
                }

                @Override
                public boolean getSessionPresent() {
                    return mqttToken.getSessionPresent();
                }

            };
            this.emitter.onSuccess(publishToken);
        }
    }

    public PublishFactory(final IMqttAsyncClient client) {
        super(client);
    }

    public Single<PublishToken> create(final String topic,
// Path: src/main/java/net/eusashead/iot/mqtt/MqttMessage.java
// public interface MqttMessage {
// 
//     boolean isRetained();
// 
//     int getQos();
// 
//     byte[] getPayload();
// 
// }
// 
// Path: src/main/java/net/eusashead/iot/mqtt/PublishToken.java
// public interface PublishToken extends MqttToken {
// 
// }


// Path: src/main/java/net/eusashead/iot/mqtt/paho/PublishFactory.java
import io.reactivex.SingleEmitter;
import net.eusashead.iot.mqtt.MqttMessage;
import java.util.Objects;
import net.eusashead.iot.mqtt.PublishToken;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.eclipse.paho.client.mqttv3.IMqttAsyncClient;
import org.eclipse.paho.client.mqttv3.IMqttToken;
import org.eclipse.paho.client.mqttv3.MqttException;
import io.reactivex.Single;

                @Override
                public String getClientId() {
                    return mqttToken.getClient().getClientId();
                }

                @Override
                public String[] getTopics() {
                    return mqttToken.getTopics();
                }

                @Override
                public int getMessageId() {
                    return mqttToken.getMessageId();
                }

                @Override
                public boolean getSessionPresent() {
                    return mqttToken.getSessionPresent();
                }

            };
            this.emitter.onSuccess(publishToken);
        }
    }

    public PublishFactory(final IMqttAsyncClient client) {
        super(client);
    }

    public Single<PublishToken> create(final String topic,
            final MqttMessage msg) {