// Path: src/main/java/me/itzg/mccy/model/ServerStatus.java
// public class ServerStatus {
// 
//     private String reportedVersion;
//     private int onlinePlayers;
//     private int maxPlayers;
//     private String reportedDescription;
//     private byte[] icon;
// 
//     @Override
//     public String toString() {
//         return MoreObjects.toStringHelper(this)
//                 .add("reportedVersion", reportedVersion)
//                 .add("onlinePlayers", onlinePlayers)
//                 .add("maxPlayers", maxPlayers)
//                 .add("reportedDescription", reportedDescription)
//                 .add("icon", icon != null ? String.format("(%d bytes)", icon.length) : "null")
//                 .toString();
//     }
// 
//     public void setReportedVersion(String reportedVersion) {
//         this.reportedVersion = reportedVersion;
//     }
// 
//     public String getReportedVersion() {
//         return reportedVersion;
//     }
// 
//     public void setOnlinePlayers(int onlinePlayers) {
//         this.onlinePlayers = onlinePlayers;
//     }
// 
//     public int getOnlinePlayers() {
//         return onlinePlayers;
//     }
// 
//     public void setMaxPlayers(int maxPlayers) {
//         this.maxPlayers = maxPlayers;
//     }
// 
//     public int getMaxPlayers() {
//         return maxPlayers;
//     }
// 
//     public void setReportedDescription(String reportedDescription) {
//         this.reportedDescription = reportedDescription;
//     }
// 
//     public String getReportedDescription() {
//         return reportedDescription;
//     }
// 
//     public void setIcon(byte[] icon) {
//         this.icon = icon;
//     }
// 
//     public byte[] getIcon() {
//         return icon;
//     }
// }
// 
// Path: src/main/java/me/itzg/mccy/services/ServerStatusService.java
// public interface ServerStatusService {
//     ServerStatus queryStatus(String host, int port) throws TimeoutException, MccyUnexpectedServerException;
// }


import me.itzg.mccy.config.MccySettings;
import me.itzg.mccy.model.ServerStatus;
import me.itzg.mccy.services.ServerStatusService;
import me.itzg.mccy.types.MccyUnexpectedServerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spacehq.mc.protocol.MinecraftConstants;
import org.spacehq.mc.protocol.MinecraftProtocol;
import org.spacehq.mc.protocol.data.SubProtocol;
import org.spacehq.mc.protocol.data.status.ServerStatusInfo;
import org.spacehq.mc.protocol.data.status.handler.ServerInfoHandler;
import org.spacehq.packetlib.Client;
import org.spacehq.packetlib.Session;
import org.spacehq.packetlib.tcp.TcpSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ConcurrentTaskExecutor;
import org.springframework.stereotype.Service;
import javax.imageio.ImageIO;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.Proxy;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
package me.itzg.mccy.services.impl;



/**
 * @author Geoff Bourne
 * @since 1/31/2016
 */
@Service
public class ServerStatusServiceImpl implements ServerStatusService {
    private static Logger LOG = LoggerFactory.getLogger(ServerStatusServiceImpl.class);

    @Autowired
    private MccySettings mccySettings;

    @Autowired
    private ConcurrentTaskExecutor remoteInvocationExecutor;

    @Override
// Path: src/main/java/me/itzg/mccy/model/ServerStatus.java
// public class ServerStatus {
// 
//     private String reportedVersion;
//     private int onlinePlayers;
//     private int maxPlayers;
//     private String reportedDescription;
//     private byte[] icon;
// 
//     @Override
//     public String toString() {
//         return MoreObjects.toStringHelper(this)
//                 .add("reportedVersion", reportedVersion)
//                 .add("onlinePlayers", onlinePlayers)
//                 .add("maxPlayers", maxPlayers)
//                 .add("reportedDescription", reportedDescription)
//                 .add("icon", icon != null ? String.format("(%d bytes)", icon.length) : "null")
//                 .toString();
//     }
// 
//     public void setReportedVersion(String reportedVersion) {
//         this.reportedVersion = reportedVersion;
//     }
// 
//     public String getReportedVersion() {
//         return reportedVersion;
//     }
// 
//     public void setOnlinePlayers(int onlinePlayers) {
//         this.onlinePlayers = onlinePlayers;
//     }
// 
//     public int getOnlinePlayers() {
//         return onlinePlayers;
//     }
// 
//     public void setMaxPlayers(int maxPlayers) {
//         this.maxPlayers = maxPlayers;
//     }
// 
//     public int getMaxPlayers() {
//         return maxPlayers;
//     }
// 
//     public void setReportedDescription(String reportedDescription) {
//         this.reportedDescription = reportedDescription;
//     }
// 
//     public String getReportedDescription() {
//         return reportedDescription;
//     }
// 
//     public void setIcon(byte[] icon) {
//         this.icon = icon;
//     }
// 
//     public byte[] getIcon() {
//         return icon;
//     }
// }
// 
// Path: src/main/java/me/itzg/mccy/services/ServerStatusService.java
// public interface ServerStatusService {
//     ServerStatus queryStatus(String host, int port) throws TimeoutException, MccyUnexpectedServerException;
// }


// Path: src/main/java/me/itzg/mccy/services/impl/ServerStatusServiceImpl.java
import me.itzg.mccy.config.MccySettings;
import me.itzg.mccy.model.ServerStatus;
import me.itzg.mccy.services.ServerStatusService;
import me.itzg.mccy.types.MccyUnexpectedServerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spacehq.mc.protocol.MinecraftConstants;
import org.spacehq.mc.protocol.MinecraftProtocol;
import org.spacehq.mc.protocol.data.SubProtocol;
import org.spacehq.mc.protocol.data.status.ServerStatusInfo;
import org.spacehq.mc.protocol.data.status.handler.ServerInfoHandler;
import org.spacehq.packetlib.Client;
import org.spacehq.packetlib.Session;
import org.spacehq.packetlib.tcp.TcpSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ConcurrentTaskExecutor;
import org.springframework.stereotype.Service;
import javax.imageio.ImageIO;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.Proxy;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

package me.itzg.mccy.services.impl;



/**
 * @author Geoff Bourne
 * @since 1/31/2016
 */
@Service
public class ServerStatusServiceImpl implements ServerStatusService {
    private static Logger LOG = LoggerFactory.getLogger(ServerStatusServiceImpl.class);

    @Autowired
    private MccySettings mccySettings;

    @Autowired
    private ConcurrentTaskExecutor remoteInvocationExecutor;

    @Override
    public ServerStatus queryStatus(String host, int port) throws TimeoutException, MccyUnexpectedServerException {