@@ -0,0 +1,2440 @@
+package com.wizzardo.http;%0A%0Aimport com.wizzardo.http.request.Header;%0Aimport com.wizzardo.http.request.MultiPartEntry;%0Aimport com.wizzardo.tools.io.IOTools;%0Aimport com.wizzardo.tools.security.MD5;%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0A%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.util.Random;%0Aimport java.util.concurrent.atomic.AtomicInteger;%0A%0Aimport static org.junit.Assert.*;%0A%0A/**%0A * Created by wizzardo on 08.01.16.%0A */%0Apublic class MultipartHandlerTest extends ServerTest %7B%0A    @Override%0A    public void setUp() throws NoSuchMethodException, ClassNotFoundException, NoSuchFieldException %7B%0A        workers = 0;%0A        super.setUp();%0A    %7D%0A%0A    @Test%0A    public void testPostParams() throws IOException %7B%0A        byte%5B%5D data = new byte%5B10 * 1024 * 1024%5D;%0A        new Random().nextBytes(data);%0A        final String md5 = MD5.create().update(data).asString();%0A%0A        handler = new MultipartHandler((request, response) -%3E %7B%0A            Assert.assertEquals(true, request.isMultipart());%0A            byte%5B%5D bytes = request.entry(%22data%22).asBytes();%0A            return response.setBody(MD5.create().update(bytes).asString());%0A        %7D);%0A%0A        Assert.assertEquals(md5, makeRequest(%22/%22)%0A                .addByteArray(%22data%22, data, %22just some data%22)%0A                .post().asString());%0A%0A%0A        handler = new MultipartHandler((request, response) -%3E %7B%0A            Assert.assertEquals(null, request.data());%0A            Assert.assertEquals(true, request.isMultipart());%0A%0A            MultiPartEntry entry = request.entry(%22data%22);%0A            String value = entry.asString();%0A            Assert.assertEquals(%22some data%22, value);%0A            Assert.assertEquals(%22just some data%22, entry.fileName());%0A%0A            MultiPartEntry empty = request.entry(%22empty%22);%0A            Assert.assertEquals(0, empty.asBytes().length);%0A            Assert.assertEquals(%22%22, empty.fileName());%0A%0A            Assert.assertEquals(%22bar%22, request.param(%22foo%22));%0A            Assert.assertEquals(%22barbar%22, request.param(%22foofoo%22));%0A%0A            return response.setBody(%22ok%22);%0A        %7D);%0A%0A        Assert.assertEquals(%22ok%22, makeRequest(%22/%22)%0A                .param(%22foo%22, %22bar%22)%0A                .addByteArray(%22data%22, %22some data%22.getBytes(), %22just some data%22)%0A                .addByteArray(%22empty%22, new byte%5B0%5D, %22%22)%0A                .param(%22foofoo%22, %22barbar%22)%0A                .post().asString());%0A    %7D%0A%7D

add test