}
@Override
public MultiMap params() {
if (params == null) {
QueryStringDecoder queryStringDecoder = new QueryStringDecoder(uri());
Map<String, List<String>> prms = queryStringDecoder.parameters();
params = new CaseInsensitiveMultiMap();
if (!prms.isEmpty()) {
for (Map.Entry<String, List<String>> entry : prms.entrySet()) {
params.add(entry.getKey(), entry.getValue());
}
}
}
return params;
}
@Override
public InetSocketAddress remoteAddress() {
return new InetSocketAddress("127.0.0.1", 80);
}
@Override
public InetSocketAddress localAddress() {
return new InetSocketAddress("127.0.0.1", 80);
}
@Override
public X509Certificate[] peerCertificateChain() throws SSLPeerUnverifiedException {
return null;
}
@Override
public URI absoluteURI() {
return uri;
}
@Override
public HttpServerRequest bodyHandler(final Handler<Buffer> bodyHandler) {
if (bodyHandler != null) {
vertx.runOnContext(new Handler<Void>() {
@Override
public void handle(Void event) {
bodyHandler.handle(body);
}
});
}
return this;
}
@Override
public HttpServerRequest dataHandler(final Handler<Buffer> handler) {
if (handler != null) {
vertx.runOnContext(new Handler<Void>() {
@Override
public void handle(Void event) {
handler.handle(body);
}
});
}
return this;
}
@Override
public HttpServerRequest pause() {
throw new UnsupportedOperationException("This mock does not support pause");
}
@Override
public HttpServerRequest resume() {
throw new UnsupportedOperationException("This mock does not support resume");
}
@Override
public HttpServerRequest endHandler(final Handler<Void> endHandler) {
if (endHandler != null) {
vertx.runOnContext(new Handler<Void>() {
@Override
public void handle(Void event) {
endHandler.handle(null);
}
});
}
return this;
}
@Override
public NetSocket netSocket() {
return netSocket;
}
@Override
public HttpServerRequest expectMultiPart(boolean expect) {
// NOOP
return this;
}
@Override
public HttpServerRequest uploadHandler(Handler<HttpServerFileUpload> uploadHandler) {
throw new UnsupportedOperationException("This mock does not support uploadHandler");
}
@Override
public MultiMap formAttributes() {
if (attributes == null) {
attributes = new CaseInsensitiveMultiMap();
if (urlEncoded) {
QueryStringDecoder queryStringDecoder = new QueryStringDecoder(body.toString(), false);
Map<String, List<String>> prms = queryStringDecoder.parameters();
if (!prms.isEmpty()) {
for (Map.Entry<String, List<String>> entry : prms.entrySet()) {
attributes.add(entry.getKey(), entry.getValue());
}