// Path: marketdata-common/src/main/java/com/handson/dto/Stock.java
// public class Stock {
// 
//     public final String code;
// 
//     public final String companyName;
// 
//     public final String market;
// 
//     public Stock(String code, String companyName, String market) {
//         this.code = code;
//         this.companyName = companyName;
//         this.market = market;
//     }
// 
//     public static Stock fromJson(String input) {
//         return new Gson().fromJson(input, Stock.class);
//     }
// 
// 
//     public String toJson() {
//         return new Gson().toJson(this);
//     }
// 
//     @Override
//     public String toString() {
//         return toJson();
//     }
// }
// 
// Path: marketdata-common/src/main/java/com/handson/infra/HttpRequest.java
// public class HttpRequest {
// 
//     private final Map<String, List<String>> parameters;
// 
//     public HttpRequest(Map<String, List<String>> parameters) {
//         this.parameters = parameters;
//     }
// 
//     public String getParameter(String name) {
//         if (parameters.get(name) == null) {
//             return null;
//         }
//         return parameters.get(name).get(0);
//     }
// }
// 
// Path: marketdata-common/src/main/java/com/handson/infra/RxNettyRequestReplyServer.java
// public abstract class RxNettyRequestReplyServer {
// 
//     private final int port;
// 
//     private final String paramName;
// 
//     public RxNettyRequestReplyServer(int port, String paramName) {
//         this.port = port;
//         this.paramName = paramName;
//     }
// 
//     public HttpServer<ByteBuf, ByteBuf> createServer() {
//         return RxNetty.createHttpServer(port, (request, response) -> {
// 
//             HttpRequest httpRequest = new HttpRequest(request.getQueryParameters());
//             String content = getResponseContent(httpRequest);
//             return response.writeStringAndFlush(content);
//         });
//     }
// 
//     protected abstract String getResponseContent(HttpRequest request);
// 
// }


import com.handson.dto.Stock;
import com.handson.infra.HttpRequest;
import com.handson.infra.RxNettyRequestReplyServer;
import java.util.HashMap;
import java.util.Map;
package com.handson.market;




public class StaticDataProvider extends RxNettyRequestReplyServer {

    private final Map<String, Stock> stocks;

    public StaticDataProvider(int port) {
        super(port, "code");

        stocks = new HashMap<>();
        stocks.put("GOOGL", new Stock("GOOGL", "Alphabet Inc", "NASDAQ"));
        stocks.put("IBM", new Stock("IBM", "International Business Machines Corp.", "NYSE"));
        stocks.put("AAPL", new Stock("AAPL", "Apple Inc.", "NASDAQ"));
        stocks.put("HPQ", new Stock("HPQ", "HP Inc", "NYSE"));
        stocks.put("MSFT", new Stock("MSFT", "Microsoft Corporation", "NASDAQ"));
        stocks.put("CRM", new Stock("CRM", "salesforce.com, inc.", "NYSE"));
        stocks.put("ADBE", new Stock("ADBE", "Adobe Systems Incorporated", "NASDAQ"));
        stocks.put("ORCL", new Stock("ORCL", "Oracle Corporation", "NYSE"));

    }

    @Override
// Path: marketdata-common/src/main/java/com/handson/dto/Stock.java
// public class Stock {
// 
//     public final String code;
// 
//     public final String companyName;
// 
//     public final String market;
// 
//     public Stock(String code, String companyName, String market) {
//         this.code = code;
//         this.companyName = companyName;
//         this.market = market;
//     }
// 
//     public static Stock fromJson(String input) {
//         return new Gson().fromJson(input, Stock.class);
//     }
// 
// 
//     public String toJson() {
//         return new Gson().toJson(this);
//     }
// 
//     @Override
//     public String toString() {
//         return toJson();
//     }
// }
// 
// Path: marketdata-common/src/main/java/com/handson/infra/HttpRequest.java
// public class HttpRequest {
// 
//     private final Map<String, List<String>> parameters;
// 
//     public HttpRequest(Map<String, List<String>> parameters) {
//         this.parameters = parameters;
//     }
// 
//     public String getParameter(String name) {
//         if (parameters.get(name) == null) {
//             return null;
//         }
//         return parameters.get(name).get(0);
//     }
// }
// 
// Path: marketdata-common/src/main/java/com/handson/infra/RxNettyRequestReplyServer.java
// public abstract class RxNettyRequestReplyServer {
// 
//     private final int port;
// 
//     private final String paramName;
// 
//     public RxNettyRequestReplyServer(int port, String paramName) {
//         this.port = port;
//         this.paramName = paramName;
//     }
// 
//     public HttpServer<ByteBuf, ByteBuf> createServer() {
//         return RxNetty.createHttpServer(port, (request, response) -> {
// 
//             HttpRequest httpRequest = new HttpRequest(request.getQueryParameters());
//             String content = getResponseContent(httpRequest);
//             return response.writeStringAndFlush(content);
//         });
//     }
// 
//     protected abstract String getResponseContent(HttpRequest request);
// 
// }


// Path: marketdata-external/src/main/java/com/handson/market/StaticDataProvider.java
import com.handson.dto.Stock;
import com.handson.infra.HttpRequest;
import com.handson.infra.RxNettyRequestReplyServer;
import java.util.HashMap;
import java.util.Map;

package com.handson.market;




public class StaticDataProvider extends RxNettyRequestReplyServer {

    private final Map<String, Stock> stocks;

    public StaticDataProvider(int port) {
        super(port, "code");

        stocks = new HashMap<>();
        stocks.put("GOOGL", new Stock("GOOGL", "Alphabet Inc", "NASDAQ"));
        stocks.put("IBM", new Stock("IBM", "International Business Machines Corp.", "NYSE"));
        stocks.put("AAPL", new Stock("AAPL", "Apple Inc.", "NASDAQ"));
        stocks.put("HPQ", new Stock("HPQ", "HP Inc", "NYSE"));
        stocks.put("MSFT", new Stock("MSFT", "Microsoft Corporation", "NASDAQ"));
        stocks.put("CRM", new Stock("CRM", "salesforce.com, inc.", "NYSE"));
        stocks.put("ADBE", new Stock("ADBE", "Adobe Systems Incorporated", "NASDAQ"));
        stocks.put("ORCL", new Stock("ORCL", "Oracle Corporation", "NYSE"));

    }

    @Override
    protected String getResponseContent(HttpRequest request) {