// Path: fos-common/src/main/java/com/feedzai/fos/common/kryo/CustomUUIDSerializer.java
// public class CustomUUIDSerializer extends Serializer<UUID> {
// 
//     @Override
//     public void write(Kryo kryo, Output output, UUID uuid) {
//         output.writeLong(uuid.getMostSignificantBits(), false);
//         output.writeLong(uuid.getLeastSignificantBits(), false);
//     }
// 
//     @Override
//     public UUID read(Kryo kryo, Input input, Class<UUID> uuidClass) {
//         return new UUID(input.readLong(false),
//                         input.readLong(false));
//     }
// }
// 
// Path: fos-common/src/main/java/com/feedzai/fos/common/kryo/ScoringRequestEnvelope.java
// public class ScoringRequestEnvelope {
//     /**
//      * List of classifier uuid to score
//      */
//     List<UUID> uuids;
// 
//     /**
//      * Instance to score
//      */
//     Object[] instance;
// 
//     /**
//      * Empty constructor to allow kryo to create new instances
//      */
//     public ScoringRequestEnvelope() {
//     }
// 
//     /**
//      * Sets the list of UUIDs to score
//      * @param uuids list of uuids to score
//      */
//     public void setUuids(List<UUID> uuids) {
//         this.uuids = uuids;
//     }
// 
//     /**
//      * Sets the instance to score
//      * @param instance instance to score
//      */
//     public void setInstance(Object[] instance) {
//         this.instance = instance;
//     }
// 
//     /**
//      * Creates a new scoring envelope
//      *
//      * @param uuids   List of classifier uuid to score
//      * @param instance instance to score
//      */
//     public ScoringRequestEnvelope(List<UUID> uuids,
//                                   Object[] instance) {
//         this.uuids = uuids;
//         this.instance = instance;
//     }
// 
//     /**
//      * Returns the list of UUID to score
//      * @return list of UUID to score
//      */
//     public List<UUID> getUUIDs() {
//         return uuids;
//     }
// 
//     /**
//      * Returns the instance to score
//      * @return the instance to score
//      */
//     public Object[] getInstance() {
//         return instance;
//     }
// }


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import com.feedzai.fos.common.kryo.CustomUUIDSerializer;
import com.feedzai.fos.common.kryo.ScoringRequestEnvelope;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
    }

    /**
     * This class implements the internal Kryo scoring backend
     */
    private static class RemoteConnection implements Scorer {
        /*
         * Buffer size in bytes to be used for Kryo i/o.
         * It should be noted that (beyond reasonable values)
         * this does not impose any limits to the size of objects to be read/written
         * if the internal buffer is exausted/underflows, kryo will flush or read
         * more data from the associated inputstream.
         *
         */
        public static final int BUFFER_SIZE = 1024;  // bytes
        final Socket s; // socket that represents client connection
        InputStream is;
        OutputStream os;
        Kryo kryo;
        Input input;
        Output output;


        RemoteConnection(String host, int port) throws IOException {
            s = new Socket(host, port);
            // Disable naggle Algorithm to decrease latency
            s.setTcpNoDelay(true);
            is = s.getInputStream();
            os = s.getOutputStream();
            kryo = new Kryo();
// Path: fos-common/src/main/java/com/feedzai/fos/common/kryo/CustomUUIDSerializer.java
// public class CustomUUIDSerializer extends Serializer<UUID> {
// 
//     @Override
//     public void write(Kryo kryo, Output output, UUID uuid) {
//         output.writeLong(uuid.getMostSignificantBits(), false);
//         output.writeLong(uuid.getLeastSignificantBits(), false);
//     }
// 
//     @Override
//     public UUID read(Kryo kryo, Input input, Class<UUID> uuidClass) {
//         return new UUID(input.readLong(false),
//                         input.readLong(false));
//     }
// }
// 
// Path: fos-common/src/main/java/com/feedzai/fos/common/kryo/ScoringRequestEnvelope.java
// public class ScoringRequestEnvelope {
//     /**
//      * List of classifier uuid to score
//      */
//     List<UUID> uuids;
// 
//     /**
//      * Instance to score
//      */
//     Object[] instance;
// 
//     /**
//      * Empty constructor to allow kryo to create new instances
//      */
//     public ScoringRequestEnvelope() {
//     }
// 
//     /**
//      * Sets the list of UUIDs to score
//      * @param uuids list of uuids to score
//      */
//     public void setUuids(List<UUID> uuids) {
//         this.uuids = uuids;
//     }
// 
//     /**
//      * Sets the instance to score
//      * @param instance instance to score
//      */
//     public void setInstance(Object[] instance) {
//         this.instance = instance;
//     }
// 
//     /**
//      * Creates a new scoring envelope
//      *
//      * @param uuids   List of classifier uuid to score
//      * @param instance instance to score
//      */
//     public ScoringRequestEnvelope(List<UUID> uuids,
//                                   Object[] instance) {
//         this.uuids = uuids;
//         this.instance = instance;
//     }
// 
//     /**
//      * Returns the list of UUID to score
//      * @return list of UUID to score
//      */
//     public List<UUID> getUUIDs() {
//         return uuids;
//     }
// 
//     /**
//      * Returns the instance to score
//      * @return the instance to score
//      */
//     public Object[] getInstance() {
//         return instance;
//     }
// }


// Path: fos-api/src/main/java/com/feedzai/fos/api/KryoScorer.java
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import com.feedzai.fos.common.kryo.CustomUUIDSerializer;
import com.feedzai.fos.common.kryo.ScoringRequestEnvelope;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

    }

    /**
     * This class implements the internal Kryo scoring backend
     */
    private static class RemoteConnection implements Scorer {
        /*
         * Buffer size in bytes to be used for Kryo i/o.
         * It should be noted that (beyond reasonable values)
         * this does not impose any limits to the size of objects to be read/written
         * if the internal buffer is exausted/underflows, kryo will flush or read
         * more data from the associated inputstream.
         *
         */
        public static final int BUFFER_SIZE = 1024;  // bytes
        final Socket s; // socket that represents client connection
        InputStream is;
        OutputStream os;
        Kryo kryo;
        Input input;
        Output output;


        RemoteConnection(String host, int port) throws IOException {
            s = new Socket(host, port);
            // Disable naggle Algorithm to decrease latency
            s.setTcpNoDelay(true);
            is = s.getInputStream();
            os = s.getOutputStream();
            kryo = new Kryo();
            kryo.addDefaultSerializer(UUID.class, new CustomUUIDSerializer());