package com.qiankun.controller;

import java.io.IOException;
import java.nio.charset.Charset;

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.junit.Test;

public class WebSiteTest {

	@Test
	public void testReceiveMessage() throws IOException {
	    /*CloseableHttpClient httpclient = HttpClients.createDefault();
		
		HttpPost post = new HttpPost("http://localhost:8080/gdg/register");


		MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
//		multipartEntityBuilder.addBinaryBody("attachFile", new File("C:/animated-overlay.gif"));
//      multipartEntityBuilder.addBinaryBody("attachFile", new File("C:/1.png"));
		
		multipartEntityBuilder.addTextBody("userId", "liuchao" , ContentType.create("text/plain", Charset.forName("UTF-8")));
		multipartEntityBuilder.addTextBody("userName", "刘超" , ContentType.create("text/plain", Charset.forName("UTF-8")));
		multipartEntityBuilder.addTextBody("mobile", "13034333345" , ContentType.create("text/plain", Charset.forName("UTF-8")));
		multipartEntityBuilder.addTextBody("address", "住址" , ContentType.create("text/plain", Charset.forName("UTF-8")));
		multipartEntityBuilder.addTextBody("company", "公司" , ContentType.create("text/plain", Charset.forName("UTF-8")));
		multipartEntityBuilder.addTextBody("position", "文员" , ContentType.create("text/plain", Charset.forName("UTF-8")));

		
		post.setEntity(multipartEntityBuilder.build());
		CloseableHttpResponse response = httpclient.execute(post);
		try {
			org.junit.Assert.assertTrue(response.getStatusLine().getStatusCode() == 200);
		} finally {
		    
		    response.close();
		}*/
	}
}
