@Test public void testOneRequestWithFixLengthEntity() throws ProtocolException { String req = "\r\nPOST /craft/webservice/helloWS HTTP/1.1\r\nContent-Type: text/xml; charset=UTF-8\r\nAccept: */*\r\nSOAPAction: \"\"\r\nUser-Agent: Apache CXF 2.4.0\r\nCache-Control: no-cache\r\nPragma: no-cache\r\nHost: localhost:9999\r\nConnection: keep-alive\r\nContent-Length: 194\r\n\r\n<soap:Envelope xmlns:soap=\"http: List<HttpRequest> reqs = decoder.decode(req.getBytes(charset)); Assert.assertEquals(1, reqs.size()); LOG.debug("[CRAFT-ATOM-PROTOCOL-HTTP] Encoded request={}", new String(encoder.encode(reqs.get(0)), charset)); System.out.println(String.format("[CRAFT-ATOM-PROTOCOL-HTTP] (^_^) <%s> Case -> test one request with fix length entity. ", CaseCounter.incr(1))); }
@Override public List<HttpRequest> decode(byte[] bytes) throws ProtocolException { try { return decode0(bytes); } catch (Exception e) { clear(); resetIndex(); if (e instanceof ProtocolException) { throw (ProtocolException) e; } throw new ProtocolException(e); } }
HttpRequestDecoder extends HttpDecoder<HttpRequest> implements ProtocolDecoder<HttpRequest> { @Override public List<HttpRequest> decode(byte[] bytes) throws ProtocolException { try { return decode0(bytes); } catch (Exception e) { clear(); resetIndex(); if (e instanceof ProtocolException) { throw (ProtocolException) e; } throw new ProtocolException(e); } } }
HttpRequestDecoder extends HttpDecoder<HttpRequest> implements ProtocolDecoder<HttpRequest> { @Override public List<HttpRequest> decode(byte[] bytes) throws ProtocolException { try { return decode0(bytes); } catch (Exception e) { clear(); resetIndex(); if (e instanceof ProtocolException) { throw (ProtocolException) e; } throw new ProtocolException(e); } } HttpRequestDecoder();  HttpRequestDecoder(Charset charset);  HttpRequestDecoder(Charset charset, int defaultBufferSize);  HttpRequestDecoder(Charset charset, int defaultBufferSize, int maxLineLength);  HttpRequestDecoder(Charset charset, int defaultBufferSize, int maxLineLength, int maxRequestSize); }
HttpRequestDecoder extends HttpDecoder<HttpRequest> implements ProtocolDecoder<HttpRequest> { @Override public List<HttpRequest> decode(byte[] bytes) throws ProtocolException { try { return decode0(bytes); } catch (Exception e) { clear(); resetIndex(); if (e instanceof ProtocolException) { throw (ProtocolException) e; } throw new ProtocolException(e); } } HttpRequestDecoder();  HttpRequestDecoder(Charset charset);  HttpRequestDecoder(Charset charset, int defaultBufferSize);  HttpRequestDecoder(Charset charset, int defaultBufferSize, int maxLineLength);  HttpRequestDecoder(Charset charset, int defaultBufferSize, int maxLineLength, int maxRequestSize); @Override List<HttpRequest> decode(byte[] bytes); }
HttpRequestDecoder extends HttpDecoder<HttpRequest> implements ProtocolDecoder<HttpRequest> { @Override public List<HttpRequest> decode(byte[] bytes) throws ProtocolException { try { return decode0(bytes); } catch (Exception e) { clear(); resetIndex(); if (e instanceof ProtocolException) { throw (ProtocolException) e; } throw new ProtocolException(e); } } HttpRequestDecoder();  HttpRequestDecoder(Charset charset);  HttpRequestDecoder(Charset charset, int defaultBufferSize);  HttpRequestDecoder(Charset charset, int defaultBufferSize, int maxLineLength);  HttpRequestDecoder(Charset charset, int defaultBufferSize, int maxLineLength, int maxRequestSize); @Override List<HttpRequest> decode(byte[] bytes);  }