@Test public void avroRespondTest() throws DSPException, IOException { OpenRTBAPIDummyTest bidder = new OpenRTBAPIDummyTest(); DemandSideDAODummyTest dao = new DemandSideDAODummyTest(); URL url = this.getClass().getResource("/properties.json"); dao.loadData(url.getPath()); DemandSideServer server = new DemandSideServer(bidder, dao); InputStream in = new ByteArrayInputStream(writeBidRequest(request, AVRO_CONTENT_TYPE)); server.respond("BigAdExchange", in, AVRO_CONTENT_TYPE); }
public byte[] respond(String sspName, InputStream inStream, String requestContentType) throws DSPException { try { BidRequest bidRequest = readRequest(inStream, requestContentType); RTBRequestWrapper wReq = new RTBRequestWrapper(bidRequest); long reqTimeout = dspDAO.getDefaultTimeout("request_timeout"); long offerTimeout = dspDAO.getDefaultTimeout("offer_timeout"); wReq.setContext(dspDAO.getExchanges().get(sspName), dspDAO.getAdvertisers(), reqTimeout, offerTimeout); BidResponse bidResponse = bidder.process(wReq); return writeResponse(bidResponse, requestContentType); } catch (Exception e) { logger.error(StringUtils.stackTraceToString(e)); throw new DSPException(e); } }
DemandSideServer { public byte[] respond(String sspName, InputStream inStream, String requestContentType) throws DSPException { try { BidRequest bidRequest = readRequest(inStream, requestContentType); RTBRequestWrapper wReq = new RTBRequestWrapper(bidRequest); long reqTimeout = dspDAO.getDefaultTimeout("request_timeout"); long offerTimeout = dspDAO.getDefaultTimeout("offer_timeout"); wReq.setContext(dspDAO.getExchanges().get(sspName), dspDAO.getAdvertisers(), reqTimeout, offerTimeout); BidResponse bidResponse = bidder.process(wReq); return writeResponse(bidResponse, requestContentType); } catch (Exception e) { logger.error(StringUtils.stackTraceToString(e)); throw new DSPException(e); } } }
DemandSideServer { public byte[] respond(String sspName, InputStream inStream, String requestContentType) throws DSPException { try { BidRequest bidRequest = readRequest(inStream, requestContentType); RTBRequestWrapper wReq = new RTBRequestWrapper(bidRequest); long reqTimeout = dspDAO.getDefaultTimeout("request_timeout"); long offerTimeout = dspDAO.getDefaultTimeout("offer_timeout"); wReq.setContext(dspDAO.getExchanges().get(sspName), dspDAO.getAdvertisers(), reqTimeout, offerTimeout); BidResponse bidResponse = bidder.process(wReq); return writeResponse(bidResponse, requestContentType); } catch (Exception e) { logger.error(StringUtils.stackTraceToString(e)); throw new DSPException(e); } } DemandSideServer();  DemandSideServer(OpenRTBAPI bidder, DemandSideDAO dao); }
DemandSideServer { public byte[] respond(String sspName, InputStream inStream, String requestContentType) throws DSPException { try { BidRequest bidRequest = readRequest(inStream, requestContentType); RTBRequestWrapper wReq = new RTBRequestWrapper(bidRequest); long reqTimeout = dspDAO.getDefaultTimeout("request_timeout"); long offerTimeout = dspDAO.getDefaultTimeout("offer_timeout"); wReq.setContext(dspDAO.getExchanges().get(sspName), dspDAO.getAdvertisers(), reqTimeout, offerTimeout); BidResponse bidResponse = bidder.process(wReq); return writeResponse(bidResponse, requestContentType); } catch (Exception e) { logger.error(StringUtils.stackTraceToString(e)); throw new DSPException(e); } } DemandSideServer();  DemandSideServer(OpenRTBAPI bidder, DemandSideDAO dao); void init(String dbLocation); boolean authorizeRemoteService(String sspOrgName); synchronized boolean verifyContentType(String sspName,
			String contentType); byte[] respond(String sspName, InputStream inStream,
			String requestContentType); BidRequest readRequest(InputStream is, String contentType); }
DemandSideServer { public byte[] respond(String sspName, InputStream inStream, String requestContentType) throws DSPException { try { BidRequest bidRequest = readRequest(inStream, requestContentType); RTBRequestWrapper wReq = new RTBRequestWrapper(bidRequest); long reqTimeout = dspDAO.getDefaultTimeout("request_timeout"); long offerTimeout = dspDAO.getDefaultTimeout("offer_timeout"); wReq.setContext(dspDAO.getExchanges().get(sspName), dspDAO.getAdvertisers(), reqTimeout, offerTimeout); BidResponse bidResponse = bidder.process(wReq); return writeResponse(bidResponse, requestContentType); } catch (Exception e) { logger.error(StringUtils.stackTraceToString(e)); throw new DSPException(e); } } DemandSideServer();  DemandSideServer(OpenRTBAPI bidder, DemandSideDAO dao); void init(String dbLocation); boolean authorizeRemoteService(String sspOrgName); synchronized boolean verifyContentType(String sspName,
			String contentType); byte[] respond(String sspName, InputStream inStream,
			String requestContentType); BidRequest readRequest(InputStream is, String contentType);  }