blob: e43eb30277b97124492f85c12afa37adc19eb0f3 [file] [log] [blame]
chrismair00dc7bd2014-05-11 21:21:28 +00001/*
2 * Copyright 2009 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.mockftpserver.fake.command
17
18import org.mockftpserver.core.command.Command
19import org.mockftpserver.core.command.CommandHandler
20import org.mockftpserver.core.command.CommandNames
21import org.mockftpserver.core.command.ReplyCodes
22
23/**
24 * Tests for EpsvCommandHandler
25 *
26 * @version $Revision$ - $Date$
27 *
28 * @author Chris Mair
29 */
30class EpsvCommandHandlerTest extends AbstractFakeCommandHandlerTestCase {
31
32 static final SERVER = InetAddress.getByName("1080::8:800:200C:417A")
33 static final PORT = 6275
34
35 void testHandleCommand() {
36 session.switchToPassiveModeReturnValue = PORT
37 session.serverHost = SERVER
38 handleCommand([])
39
40 assertSessionReply(ReplyCodes.EPSV_OK, PORT as String)
41 assert session.switchedToPassiveMode
42 }
43
44 //-------------------------------------------------------------------------
45 // Helper Methods
46 //-------------------------------------------------------------------------
47
48 CommandHandler createCommandHandler() {
49 new EpsvCommandHandler()
50 }
51
52 Command createValidCommand() {
53 return new Command(CommandNames.EPSV, [])
54 }
55
56}