@Override public int read(final byte[] b) throws IOException { if (b == null) { return 0; } return read(b, 0, b.length); }
@Override public int read(final byte[] b) throws IOException { if (b == null) { return 0; } return read(b, 0, b.length); }
@Override public int read(final byte[] b) throws IOException { if (b == null) { return 0; } return read(b, 0, b.length); }
public int read(final byte[] b) throws IOException { if (b == null) { return 0; } return read(b, 0, b.length); }
public int read(final byte[] b) throws IOException { if (b == null) { return 0; } return read(b, 0, b.length); }
@Override public int read(final byte[] b) throws IOException { if (b == null) { return 0; } return read(b, 0, b.length); }
body += (char) buffer.read();
private ExpectedResult parseExpectedResponse(Element element, Evaluator evaluator, ResultRecorder resultRecorder) { String contents = getTextAndRemoveIndent(element); contents = replaceVariableReferences(evaluator, contents, resultRecorder); SessionInputBufferImpl buffer = new SessionInputBufferImpl(new HttpTransportMetricsImpl(), contents.length()); buffer.bind(new ByteArrayInputStream(contents.getBytes(StandardCharsets.UTF_8))); DefaultHttpResponseParser defaultHttpResponseParser = new DefaultHttpResponseParser(buffer); ExpectedResult.ExpectedResultBuilder builder = expectedResult(); String body = null; try { HttpResponse httpResponse = defaultHttpResponseParser.parse(); StatusLine statusLine = httpResponse.getStatusLine(); builder.withStatus(statusLine.getStatusCode()); for (Header header : httpResponse.getAllHeaders()) { builder.withHeader(header.getName(), header.getValue()); } if (buffer.hasBufferedData()) { body = ""; while (buffer.hasBufferedData()) { body += (char) buffer.read(); } } builder.withBody(body); } catch (IOException | HttpException e) { e.printStackTrace(); } return builder.build(); }