Package waffle.util

Source Code of waffle.util.NtlmServletRequestTests

/**
* Waffle (https://github.com/dblock/waffle)
*
* Copyright (c) 2010 - 2014 Application Security, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*     Application Security, Inc.
*/
package waffle.util;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import waffle.mock.http.SimpleHttpRequest;

/**
* @author dblock[at]dblock[dot]org
*/
public class NtlmServletRequestTests {

    @Test
    public void testGetConnectionId() {
        SimpleHttpRequest.resetRemotePort();
        SimpleHttpRequest request1 = new SimpleHttpRequest();
        assertEquals(":1", NtlmServletRequest.getConnectionId(request1));
        SimpleHttpRequest request2 = new SimpleHttpRequest();
        assertEquals(":2", NtlmServletRequest.getConnectionId(request2));
        request2.setRemoteAddr("192.168.1.1");
        assertEquals("192.168.1.1:2", NtlmServletRequest.getConnectionId(request2));
        request2.setRemoteHost("codeplex.com");
        assertEquals("codeplex.com:2", NtlmServletRequest.getConnectionId(request2));
    }
}
TOP

Related Classes of waffle.util.NtlmServletRequestTests

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.