CN105376107B - Terminal testing method and proxy server - Google Patents

Terminal testing method and proxy server Download PDF

Info

Publication number
CN105376107B
CN105376107B CN201410438024.5A CN201410438024A CN105376107B CN 105376107 B CN105376107 B CN 105376107B CN 201410438024 A CN201410438024 A CN 201410438024A CN 105376107 B CN105376107 B CN 105376107B
Authority
CN
China
Prior art keywords
proxy server
port
address
identifier
application server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410438024.5A
Other languages
Chinese (zh)
Other versions
CN105376107A (en
Inventor
胡鹏
于维军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201410438024.5A priority Critical patent/CN105376107B/en
Publication of CN105376107A publication Critical patent/CN105376107A/en
Application granted granted Critical
Publication of CN105376107B publication Critical patent/CN105376107B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a terminal testing method and a proxy server. Wherein, the method comprises the following steps: the method comprises the following steps that a proxy server receives a request message which is sent by a terminal and used for accessing an application server, wherein the request message comprises: the first identification is used for indicating the IP address and the first port of the application server, and the second identification is used for indicating the second port of the proxy server; the proxy server acquires a first identifier and a second identifier from the request message; and the proxy server sends the request data in the request message to the first port on the application server with the IP address through the second port indicated by the second identification. The invention solves the technical problem of higher test complexity caused by configuring the mapping relation between the corresponding domain name and the IP address for each network environment on the terminal.

Description

Terminal testing method and proxy server
Technical Field
The invention relates to the field of application program testing, in particular to a terminal testing method and a proxy server.
Background
Before the terminal application program is used online, a test is needed to ensure that the terminal application program runs safely and stably in the using process. The terminal application needs to be tested through different network environments from development to online, for example, the development environment is needed to be tested in the development stage, the test environment is needed to be tested in the test stage, and the experience environment is needed to be tested in the experience stage.
In order to ensure that the terminal application can stably run in each network environment, the terminal application is tested in each network environment, which requires switching of the network environments. In the prior art, the following method is generally adopted for testing the network environment:
s1: accessing a computer to a network, starting a proxy server of software on the computer, and setting a default proxy port number;
s2: the method comprises the steps that a terminal provided with an application program is also accessed into a network where a computer is located, a proxy IP address and a proxy port number are set on the terminal, the proxy IP address is the IP address of the computer, and the port number is the default proxy port number of the computer;
s3: after the computer and the terminal are configured, the access of the terminal can enable the terminal to access a plurality of network environments by configuring and modifying rules for forwarding the request of the terminal on the computer through the proxy port of the computer.
However, since the computer as the agent and the terminal for testing need to access the same network, when the network is built, the wireless network card needs to be purchased for the computer which can not be connected with the wireless network, which increases the cost of the testing device.
In addition, it can be known from the above configuration process that, when a certain network environment is tested, a Host file corresponding to the network environment needs to be configured for the terminal, where the Host file includes: the mapping relationship between the domain name and the IP address, and the Host file cannot be changed after being configured. Thus, when testing different network environments, the terminal needs to configure the mapping relationship between the corresponding domain name and the IP address for each network environment, thereby increasing the complexity of configuration.
In view of the above-mentioned problem of high test complexity caused by configuring the mapping relationship between the corresponding domain name and the IP address for each network environment on the terminal, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides a terminal testing method and a proxy server, which at least solve the technical problem of higher testing complexity caused by configuring a mapping relation between a corresponding domain name and an IP address for each network environment on a terminal.
According to an aspect of an embodiment of the present invention, a terminal testing method is provided. The terminal testing method comprises the following steps: the method comprises the following steps that a proxy server receives a request message which is sent by a terminal and used for accessing an application server, wherein the request message comprises: a first identifier and a second identifier, the first identifier indicating an IP address and a first port of the application server, the second identifier indicating a second port of the proxy server; the proxy server acquires the first identifier and the second identifier from the request message; and the proxy server sends the request data in the request message to the first port on the application server with the IP address through the second port indicated by the second identifier.
According to another aspect of the embodiment of the invention, the invention also provides the proxy server. The proxy server includes: a receiving unit, configured to receive a request message sent by a terminal and used for accessing an application server, where the request message includes: a first identifier and a second identifier, the first identifier indicating an IP address and a first port of the application server, the second identifier indicating a second port of the proxy server; a first obtaining unit, configured to obtain the first identifier and the second identifier from the request message; and a sending unit, configured to send, through the second port indicated by the second identifier, request data in the request message to the first port on the application server addressed to the IP address.
In the embodiment of the invention, the terminal sends the identifier for indicating the port of the proxy server to the proxy server, so that the proxy server can send the request data in the request information for accessing the application server, which is sent by the terminal, to the application server according to the port set by the terminal. Therefore, the terminal can access the application servers in different network environments through different ports on the proxy server, so that the technical problem of high test complexity caused by the fact that the mapping relation between the corresponding domain name and the IP address is configured for each network environment on the terminal is solved, and the technical effect of reducing the test complexity is achieved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a schematic diagram of a hardware environment according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method of terminal testing according to an embodiment of the present invention;
FIG. 3 is a flow chart of a terminal testing method according to a preferred embodiment of the present invention;
FIG. 4 is a schematic diagram of a terminal interface according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a proxy server according to an embodiment of the present invention; and
fig. 6 is a schematic diagram of a proxy server according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Description of terms:
the Proxy Server (Proxy Server) can provide the function of transferring network information, mainly sending the request of the requester to the Server, acquiring the response content of the Server, and sending the response content back to the requester.
A terminal: the embodiment of the invention mainly relates to equipment such as a smart phone, a tablet computer, a notebook computer and the like.
Wifi: and the wireless network (Wi-Fi) is used for supporting the terminal to surf the internet in a wireless connection mode.
Port: a Port (Port) is also an outlet of the server for external communication.
Domain name: a Domain Name (Domain Name) is the Name of a computer or group of computers on the internet that consists of a string of names separated by dots, and is used to identify the electronic location of the computer during data transmission, and may correspond to one or more IP addresses, etc. The purpose of a domain name is to facilitate remembering and communicating the addresses of a set of servers.
Network environment: the network environment in the embodiment of the invention can refer to a local area network environment or a wide area network environment, and the local area network environment or the wide area network environment can also comprise one or more of a testing environment, a development environment, an experience environment and a formal environment.
Example 1
In accordance with an embodiment of the present invention, there is provided an embodiment of a method that may be performed by an embodiment of the apparatus of the present application, it being noted that the steps illustrated in the flowchart of the drawings may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than here.
According to an embodiment of the invention, a terminal testing method is provided. Alternatively, in this embodiment, the terminal testing method described above may be applied to a hardware environment formed by the terminal 101, the proxy server 102, the first application server 103, and the second application server 104 shown in fig. 1. As shown in fig. 1, the terminal 101 is connected to the proxy server 102 through a network, and the proxy server 102 is connected to the first application server 103 and the second application server 104 through the network, respectively, that is, the terminal 101 is connected to the first application server 103 or the second application server 104 through data transmission of the proxy server 102. Such networks include, but are not limited to: local area network or a plurality of local area networks, the terminal 101 may be, but is not limited to, a mobile phone, a PC, a notebook, or a tablet.
Fig. 2 is a flowchart of a terminal testing method according to an embodiment of the present invention. As shown in the figure, the terminal testing method includes the following steps S202 to S206:
step S202, the proxy server 102 receives a request message sent by the terminal 101 for accessing the application server 103, where the request message includes: the first identifier is used for indicating the IP address and the first port of the application server, and the second identifier is used for indicating the second port of the proxy server.
In step S204, the proxy server 102 obtains the first identifier and the second identifier from the request message.
In step S206, the proxy server 102 sends the request data in the request message to the first port on the application server addressed to the IP address through the second port indicated by the second identifier.
The application programs on the terminal are in different network environments at different stages, and in order to test the application programs on the terminal at different stages, the terminal needs to be in the corresponding network environment for testing. For example, in the development stage of an application program, a terminal needs to be in a development environment; in the experience stage of the application program, the terminal needs to be in an experience environment. The network environment may be a local area network or a wide area network, and during the development stage of the application program, due to the need to test the correctness of the development program of the application program, the terminal may be required to be in the network environment of the local area network for performing the related test of the development process; during the experience phase of the application, the terminal is required to be in the network environment of the wide area network to simulate the application used by the user, so as to find out the problem of the application in the using process to optimize the application.
In order to meet the requirements of the terminal for accessing different network environments, request information for accessing the application server, which is sent by the terminal, is received through the proxy server. The request carries a first identifier indicating the location of the application server and also carries a second identifier indicating the port of the proxy server.
The proxy server can know the address of the application server which is requested to be accessed by the terminal according to the first identifier, and can know the port which sends the request information by the proxy server according to the second identifier.
A plurality of ports can be configured on the proxy server, each port corresponds to a different network environment, as shown in fig. 1, the proxy server 102 is connected to the first application server 103, meanwhile, the proxy server 102 is also connected to the second application server 104, the first application server 103 can be composed of one or more servers, and optionally, a plurality of servers in the first application server 103 can be located in the same local area network; the second application server 104 may also be comprised of one or more servers, and one or more of the servers in the second application server 104 may be located in the same wide area network. The proxy server 102 may be connected to the first application server 103 through one port, and then request information through the port is transmitted to the first application server 103 by the proxy server 102, and the proxy server 102 may be connected to the second application server 104 through another port, and then request information through the port is transmitted to the second application server 104 by the proxy server 102.
The scheme in this embodiment is described below by taking the first identifier as the domain name of the application server 103 as an example, and it should be noted that the first identifier in this embodiment is not limited to the domain name of the application server 103, but may also be, but not limited to, the IP address of the application server 103.
In this embodiment, the second identifier is a second port of the proxy server 102, and the terminal testing method of this embodiment is described below with reference to table 1.
Table 1 mapping relationships configured on proxy servers
Figure BDA0000562686500000071
The first identifier may be a domain name of the application server, such as imgcache. qq.com shown in table 1, and may also be an initial IP address of the application server. This embodiment will be described by taking the first identifier imgcache.
The second identification is a port number of the proxy server, which may be 8888, or 6660 as shown in table 1.
As shown in table 1, the network environment where the application server 103 is located may be a test environment or a development environment, and when the application server 103 is in the test environment, the IP address of the proxy server is 113.108.17.145, and the port number is 8888; when the application server 103 is in the development environment, the proxy server IP address is 113.108.17.145 and the port number is 6660. In this embodiment, the technical solution in this embodiment is described by taking an example where the IP address of the proxy server is 113.108.17.145 and the port number is 8888.
For example, the proxy server 102 receives request information of the terminal 101, where the request information carries a first identifier and a second identifier, the first identifier is a domain name imgcache.qq.com of the application server, a port number of a first port of the application server is 80, and the second identifier is a port number 8888 of the proxy server. The port number of the proxy server to be accessed by the terminal 101 is 8888, and the request data output by the proxy server through the port with the port number of 8888 is sent to the test environment where the application server 103 is located.
For example, the proxy server 102 receives request information of the terminal 101, where the request information carries a first identifier and a second identifier, the first identifier is an initial IP address of 172.25.32.202 of the application server, a port number of a first port of the application server is 80, and the second identifier is a port number of 6660 of the proxy server. The port number of the proxy server to be accessed by the terminal 101 is 6660, and the request data output by the proxy server through the port with the port number of 6660 is sent to the test environment where the application server 103 is located.
And the proxy server knows that the port for sending the request data in the request message is the second port, and the IP address and the first port of the application server requested by the request message, and then the proxy server sends the request data in the request message to the first port on the application server with the address being the IP address in the first identifier according to the information in the first identifier and the second identifier.
Through the embodiment, the terminal sends the identifier for indicating the port of the proxy server to the proxy server, so that the proxy server can send the request data in the request information for accessing the application server, which is sent by the terminal, to the application server according to the port set by the terminal. Therefore, the terminal can access the application servers in different network environments through different ports on the proxy server, so that the technical problem of high test complexity caused by the fact that the mapping relation between the corresponding domain name and the IP address is configured for each network environment on the terminal is solved, and the technical effect of reducing the test complexity is achieved.
Preferably, the proxy server obtains an IP address of the application server in the predetermined network and a port number of the first port according to the first identifier and the second identifier, where the second identifier is further used to indicate the predetermined network where the application server is located; the proxy server sends the request data to the first port on the application server addressed to the IP address through the second port.
And the terminal sends a second identifier to the proxy server, wherein the second identifier can indicate the preset network where the application server is located, namely the port number of the proxy server is used as the identifier indicating the preset network where the application server is located. The second identifier indicates a second port of the proxy server, the second port can indicate a predetermined network where the application server is located, request data is output to different networks through different ports of the proxy server, and the proxy server determines the IP address of the application server and the port number of the first port in the predetermined network according to the port number of the proxy server in the second identifier sent by the terminal.
At this time, the port number of the proxy server is used as an identifier of the predetermined network, and the request data output through the port corresponding to a certain port number is output to the predetermined network, that is, different networks can be distinguished through the port number. The terminal can be connected to the network corresponding to the port number by informing the proxy server of the port number of the proxy server outputting the request data, that is, the terminal can access different networks by sending the port numbers of different proxy servers to the proxy server, thereby realizing the switching of different networks.
As shown in table 1, the port number of the proxy server corresponding to the test environment is 8888, and the port number of the proxy server corresponding to the development environment is 6660. The port number of the proxy server carried in the request information sent by the terminal 101 is 8888, the proxy server 102 sends the request data of the terminal 101 to the application server through the port with the port number of 8888, the domain name of the application server requested to be accessed by the terminal 101 is imgcache. qq.com, and the IP address of the proxy server corresponding to the domain name is 10.130.24.31:80, the proxy server 102 sends the request data of the terminal to the application server 103 with the IP address 10.130.24.31 through the port with the port number of 8888, and the application server 103 is in a test environment.
The terminal informs the proxy server of the port number of the request data, and the proxy server sends the request data through the port corresponding to the port number sent by the terminal, so that the terminal can establish connection with the application server in the network environment corresponding to the port number. The terminal only needs to send the port number to the proxy server, a set of test system does not need to be configured for each test independently, and the configuration can be performed on the proxy server once, so that the technical problem that the test complexity is high due to the fact that a set of test system needs to be set up for each network environment in the prior art is solved, and the technical effect of reducing the test complexity is achieved.
Preferably, the obtaining, by the proxy server, the IP address and the port number of the first port of the application server in the predetermined network according to the first identifier and the second identifier includes: and the proxy server acquires the IP address under the preset network corresponding to the first identifier and the port number of the first port from the mapping relation preset for the preset network indicated by the second identifier.
Each network environment corresponds to a preconfigured mapping relationship, as shown in table 1, the network environment has a mapping relationship with a port number of the proxy server, and in each network environment, there is also a mapping relationship from a domain name of the application server in the network environment to an IP address. When the application servers requested by the same domain name are in different networks, the IP addresses of the application servers in the predetermined network are different from the IP addresses in other networks, so the domain name of the same application server may correspond to the IP address. As in table 1, the application server with the domain name imgcache. qq.com maps an IP address of 10.130.24.31 in the test environment, but maps an IP address of 10.185.20.211 in the development environment. The proxy server can acquire the IP address of the application server in the predetermined network and the port number of the first port according to the preset mapping relation of the predetermined network lock indicated by the second identifier.
In this embodiment, the port number of the proxy server is 6660, the first identifier is a domain name imgcache.qq.com of the application server, a network environment corresponding to the port number 6660 is a development environment, and in a preconfigured mapping relationship corresponding to the development environment, an IP address mapped by the domain name imgcache.qq.com is 10.185.20.211, and the port number of the first port is 80.
Preferably, the first identifier includes a network domain name of the application server or an initial IP address of the application server, and the proxy server searches in a preconfigured mapping relationship whether a mapping relationship under a predetermined network indicated by the second identifier exists, where the proxy server stores mapping relationships under one network or at least two different networks in advance, and the mapping relationship under each network includes at least one of: mapping relation between network domain name and IP address and port number, and mapping relation between IP address and port number; if the mapping relation under the predetermined network indicated by the second identifier is found, the proxy server searches the mapping relation under the predetermined network indicated by the second identifier and sends the IP address under the predetermined network and the port number of the first port corresponding to the network domain name or the initial IP address included in the first identifier to the proxy server.
If the first identification request is a network domain name, the proxy server searches a mapping relation between the network domain name and the IP address of the application server and the port number of the first port in the mapping relation; if the mapping relation under the predetermined network indicated by the second identification exists and the first identification request is the initial IP address, the proxy server searches the mapping relation between the initial IP address and the IP address of the application server and the port number of the first port.
For example, the second identification is a port number of the proxy server. The proxy server searches an IP address and a port number of a first port of the application server under a preset network according to the network domain name or the initial IP address of the application server, and sends request data of the terminal to the port corresponding to the first port number of the application server corresponding to the IP address searched by the proxy server.
The preconfigured mapping on the proxy server may be as shown in table 1.
As shown in table 1, taking a network environment as an example of a test environment and a development environment, a proxy server in the test environment sends request data through a port with a port number of 8888; the proxy server in the development environment sends the request data through a port with port number 6660. The second identifier may be a port number of the proxy server, different port numbers corresponding to different networks. For example, the port number of the proxy server corresponding to the development environment is 6660, and the port number of the proxy server corresponding to the test environment is 8888. The terminal can write the port number of the corresponding proxy server in the request message according to the required network environment, and the proxy server acquires the port number of the proxy server from the request message and then sends the request data from the port corresponding to the port number.
Specifically, the proxy server receives a network domain name, such as imgcache. qq.com, sent by the terminal, or an initial IP address, such as 172.25.32.202, of the application server.
After receiving the first identifier and the second identifier, the proxy server searches whether a mapping relation under a predetermined network indicated by the second identifier exists. For example, the second identifier is 8888, the proxy server searches the mapping corresponding to the port number 8888 in table 1, i.e., searches the mapping related to the first identifier in the test environment. If the first identification request is a network domain name, the mapping relationship between the network domain name and the IP address and the port number of the application server is searched in the test environment, for example, the network domain name is i.gtimg.cn, and its corresponding IP address is 10.130.24.31 and the port number is 80. If the first identifier carries an initial IP address and the second identifier carries a port number of 6660, the IP address of the application server mapped by the IP address 172.25.32.202, which cannot be found in the environment mapped by the initial IP address if the initial IP address is found in the development environment, is 10.130.25.95 and the port number of the application server is 8080. Since the first identifier may also carry a port number of the application server, in addition to the commonly used port number 80, a port number may be specified, for example, in table 1, the port number with an IP address of 172.25.32.202 is specified as 8080.
After the proxy server maps the first identifier sent by the terminal into the IP address and the port number of the application server according to the first identifier and the second identifier, the request data of the terminal is sent to the application server corresponding to the IP address and the port number obtained according to mapping. For example, in the development stage of an application, a terminal needs to be tested in a development environment, and the port number of a proxy server corresponding to the development environment is 6660. When the terminal sends the request message to the proxy server, the domain name of the application server to be accessed by the terminal is carried in the first identifier and is imgcache. qq.com, and the port number of the proxy server is carried in the second identifier and is 6660, then the proxy server finds the IP address corresponding to the domain name of the application server in the first identifier according to the port number 6660 carried in the second identifier, as can be seen from table 1, the IP address mapped by the domain name imgcache. qq.com in the development environment is 10.185.20.211, which is different from the IP address 10.130.24.31 in the test environment. The proxy server sends the request information of the terminal to the application server corresponding to the IP address according to the IP address mapped by the proxy server, that is, the proxy server sends the request data for accessing the application server with the domain name imgcache. qq.com to the application server with the IP address 10.185.20.211. The application server is in a development environment, so that the sending terminal of the proxy server can access the application server with the domain name imgcache. If the development environment and the test environment are in the local area network and the terminal cannot directly access the application server accessed through the local area network, the application server in the local area network can be accessed through the transmission of the proxy server in the manner described above.
To further illustrate the method of testing the terminals according to the embodiments of the present invention, the following description is made with reference to fig. 1 and table 1.
The IP address of the proxy server to which the terminal 101 is connected is 113.108.17.145, and the port numbers of the two ports of the proxy server are 8888 and 6660, respectively, wherein the request data transmitted through the port number 8888 is transmitted to the first application server 103, and the request data transmitted through the port number 6660 is transmitted to the second application server 104. The first application server 103 and the second application server 104 both include a plurality of application servers, domain names of the plurality of application servers in the first application server 103 are imgcache.qq.com, i.gtimg.cn and p.qq.com, respectively, and the plurality of servers corresponding to the three domain names are in a test environment; the second application server 104 includes application servers with domain names imgcache.qq.com and i.gtimg.cn, respectively, and an application server with an IP address of 172.25.32.202, which are in a development environment.
If the port number carried by the terminal is 8888, the proxy server determines that the IP address of the application program corresponding to the requested domain name i.gtimg.cn is 10.130.24.31 according to the port number; and if the port number carried by the terminal is 6660, determining that the IP address of the application server corresponding to the requested domain name i.gtimg.cn is 10.185.20.211 according to the port number. And after acquiring the IP address and the port number of the application server, the proxy server sends the request data to the port corresponding to the port number of the application server corresponding to the determined IP address, so that the connection between the terminal and the application server is established for testing.
In the embodiment, after the proxy server receives the second identifier sent by the terminal through the mapping relationship between the port number of the proxy server, the IP address of the application server, and the domain name of the application server configured on the proxy server, the proxy server determines the domain name in the first identifier or the IP address of the application server corresponding to the initial IP address according to the second port in the second identifier, and the proxy server obtains the IP address through mapping, and sends the request data of the terminal to the application server with the IP address as the address. Because the proxy server has a mapping relation between the IP address of the application server and the port number of the proxy server, and the ports of the proxy server correspond to different network environments, the proxy server can find the IP address of the application server according to the port number and the domain name, and send the request data of the terminal to the application server corresponding to the IP address, so that the proxy server can connect the terminal to the network environment to be tested according to the port number of the second port of the terminal and the identifier for indicating the address of the application server, no matter the port numbers of a plurality of different second ports sent by one terminal or the port numbers of the same or different second ports sent by a plurality of terminals, the proxy server can connect the terminals to the network environment requested by the terminal, if the network environment needs to be switched, the terminal only needs to change the port number of the second port in the second identifier, the information on the proxy server does not need to be changed, so that the technical problem of high test complexity caused by the fact that the mapping relation between the corresponding domain name and the IP address is configured for each network environment on the terminal is solved, and the technical effect of reducing the test complexity is achieved.
Preferably, the receiving, by the proxy server, the request message for accessing the application server sent by the terminal includes: the method comprises the steps that a proxy server receives request messages sent by a plurality of terminals and used for accessing an application server; the proxy server sends request data in request messages sent by a plurality of terminals through a plurality of threads, wherein each thread is used for sending the request data in the request message sent by one terminal.
In order to ensure that the terminal can access the proxy server, the IP address of the proxy server is the IP address that the terminal can access, that is, the terminal can access the proxy server through the network.
When the proxy server receives request information for accessing the application server sent by a plurality of terminals, the proxy server can simultaneously process request data from the terminals through a plurality of threads, and each thread sends the request data in the request information sent by one assembly section. The proxy server sends the request data, so that the consumption of the memory of the proxy server is not too large, and the requirement of simultaneously sending the request data from the terminal by using a plurality of threads can be met.
By the embodiment, the request data from the terminal is processed by the multiple threads, the requirement of switching the test environments of the multiple terminals can be met, and the efficiency of switching the test environments of the terminals is improved.
Preferably, after the proxy server receives a request message for accessing the application server, the terminal testing method further includes: the proxy server acquires the IP address of the terminal and the IP section which is allowed to be accessed by the terminal by the proxy server; the proxy server judges whether the IP address of the terminal is in the IP section which is allowed to be accessed by the proxy server; and if the IP address of the terminal is in the IP section which is allowed to be accessed by the proxy server, the proxy server executes the operation of sending the request data to the first port on the application server.
After receiving a request message for accessing the application server sent by the terminal, the proxy server acquires the IP address of the terminal and the IP section which is allowed to be accessed by the terminal and is allowed to be accessed by the proxy server, and if the IP address of the terminal which requests to be connected with the proxy server is in the IP section which is allowed to be accessed by the terminal and is allowed to be accessed by the proxy server, the proxy server sends request data to a first port on the application server. That is, before the terminal accesses the application server, the terminal outside the IP segment allowing access to the application program can be intercepted to avoid malicious connection of the terminal, thereby ensuring the security of the proxy server and the application server.
The following describes a terminal testing method according to an embodiment of the present invention with reference to fig. 3. The terminal testing method comprises the following steps:
step S301, the proxy server monitors the port, i.e., the designated port.
Step S302, determine whether there is a new request, i.e. a new request.
Step S303, if the terminal requests to send request data through the port, the terminal parses the request from the terminal and obtains the domain name and the port number of the application server to be accessed by the terminal, that is, the parsing request obtains the access domain name and the port.
Step S304, determining whether the request information carried in the request information is an IP address of the accessed application server, i.e. whether the request information is directly accessed by an IP. If yes, step S307 is executed, and if no, step S305 is executed.
Step S305, if the address of the application program carried in the request of the terminal is a domain name, determining whether the domain name of the application server requested to be accessed by the terminal is the domain name of the application server that can be accessed by the proxy server, that is, determining whether the domain name is consistent with a preset domain name. If so, step S307 is executed.
Step S306, if the domain name of the application server carried in the request of the terminal is not consistent with the domain name configured in advance, the IP address and the port of the application server corresponding to the domain name are obtained, the request data of the terminal is sent through the port indicated by the terminal, and the request of the terminal is directly sent through the port corresponding to the port number indicated by the terminal, namely the IP address and the port forwarding request corresponding to the domain name are obtained.
Step S307, if the request information of the terminal carries the IP address of the application server, the request is directly forwarded.
The terminal may send the port number of the proxy server to be used to the proxy server through the interface shown in fig. 4, and optionally, the terminal may also select the IP address of the proxy server. The terminal sets the IP address 113.108.17.145 of the proxy server in the interface shown in fig. 4, and the port number of the proxy server is 6660.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
Example 2
According to an embodiment of the present invention, there is also provided a proxy server for implementing the terminal testing method, where the proxy server is mainly used to execute the terminal testing method provided in the foregoing content of the embodiment of the present invention, and the following describes the proxy server provided in the embodiment of the present invention specifically:
fig. 5 is a schematic diagram of a proxy server according to an embodiment of the present invention. As shown, the proxy server includes: a receiving unit 10, a first acquiring unit 30 and a transmitting unit 50.
The receiving unit 10 is configured to receive a request message sent by a terminal for accessing an application server, where the request message includes: the first identifier is used for indicating an IP address and a first port of the application server, the first port is a port of the application server, the second identifier is used for indicating a second port, and the second port is a port of the proxy server.
The first obtaining unit 30 is configured to obtain the first identifier and the second identifier from the request message.
The sending unit 50 is configured to send the request data in the request message to the first port on the application server addressed to the IP address through the second port indicated by the second identifier.
The application programs on the terminal are in different network environments at different stages, and in order to test the application programs on the terminal at different stages, the terminal needs to be in the corresponding network environment for testing. For example, in the development stage of an application program, a terminal needs to be in a development environment; in the experience stage of the application program, the terminal needs to be in an experience environment. The network environment may be a local area network or a wide area network, and during the development stage of the application program, due to the need to test the correctness of the development program of the application program, the terminal may be required to be in the network environment of the local area network for performing the related test of the development process; during the experience phase of the application, the terminal is required to be in the network environment of the wide area network to simulate the application used by the user, so as to find out the problem of the application in the using process to optimize the application.
In order to meet the requirements of the terminal for accessing different network environments, request information for accessing the application server, which is sent by the terminal, is received through the proxy server. The request carries a first identifier indicating the location of the application server and also carries a second identifier indicating the port of the proxy server.
The proxy server can know the address of the application server which is requested to be accessed by the terminal according to the first identifier, and can know the port which sends the request information by the proxy server according to the second identifier.
A plurality of ports can be configured on the proxy server, each port corresponds to a different network environment, as shown in fig. 1, the proxy server 102 is connected with the first application server 103, meanwhile, the proxy server 102 is also connected with the second application server 104, the first application server 103 can be formed by one or more servers, of course, a plurality of servers can form a local area network; the second application server 104 may also be comprised of one or more servers, which may be in a wide area network. The proxy server 102 may be connected to the first application server 103 through one port, and then request information through the port is transmitted to the first application server 103 by the proxy server 102, and the proxy server 102 may be connected to the second application server 104 through another port, and then request information through the port is transmitted to the second application server 104 by the proxy server 102.
The scheme in this embodiment is described below by taking the first identifier as the domain name of the application server 103 as an example, and it should be noted that the first identifier in this embodiment is not limited to the domain name of the application server 103, but may also be, but not limited to, the IP address of the application server 103.
In this embodiment, the second identifier is a second port of the proxy server 102, and the terminal testing method of this embodiment is described below with reference to table 1.
The first identifier may be a domain name of the application server, such as imgcache. qq.com shown in table 1, and may also be an initial IP address of the application server. This embodiment will be described by taking the first identifier imgcache.
The second identification is a port number of the proxy server, which may be 8888, or 6660 as shown in table 1.
As shown in table 1, the network environment where the application server 103 is located may be a test environment or a development environment, and when the application server 103 is in the test environment, the IP address of the proxy server is 113.108.17.145, and the port number is 8888; when the application server 103 is in the development environment, the proxy server IP address is 113.108.17.145 and the port number is 6660. In this embodiment, the technical solution in this embodiment is described by taking an example where the IP address of the proxy server is 113.108.17.145 and the port number is 8888.
For example, the proxy server 102 receives request information of the terminal 101, where the request information carries a first identifier and a second identifier, the first identifier is a domain name imgcache.qq.com of the application server, a port number of a first port of the application server is 80, and the second identifier is a port number 8888 of the proxy server. The port number of the proxy server to be accessed by the terminal 101 is 8888, and the request data output by the proxy server through the port with the port number of 8888 is sent to the test environment where the application server 103 is located.
For example, the proxy server 102 receives request information of the terminal 101, where the request information carries a first identifier and a second identifier, the first identifier is an initial IP address of 172.25.32.202 of the application server, a port number of a first port of the application server is 80, and the second identifier is a port number of 6660 of the proxy server. The port number of the proxy server to be accessed by the terminal 101 is 6660, and the request data output by the proxy server through the port with the port number of 6660 is sent to the test environment where the application server 103 is located.
And the proxy server knows that the port for sending the request data in the request message is the second port, and the IP address and the first port of the application server requested by the request message, and then the proxy server sends the request data in the request message to the first port on the application server with the address being the IP address in the first identifier according to the information in the first identifier and the second identifier.
Through the embodiment, the proxy server receives the request message sent by the terminal, and obtains the first identifier and the second identifier from the request message, the first identifier indicates the IP address and the first port of the application server requested to be accessed by the request message, the second identifier indicates the second port of the request data in the request message sent by the proxy server, and the proxy server sends the request data in the request message from the second port of the proxy server to the first port of the application server with the IP address in the first identifier according to the information, so that the terminal accesses the application server. The proxy server can send the request data carried by the request information to the corresponding application server through different ports, and if one terminal needs to test in different network environments, the application servers in different network environments are accessed through different ports of the proxy server; if a plurality of terminals access different application servers, even if the application servers are in different network environments, the proxy server can send request data carried by the request information to the corresponding application servers through different ports. The proxy server selects the port for sending the request data of the terminal through the second port indicated by the receiving terminal, and the terminal can be connected to different network environments under the condition that the IP address and the port of the proxy computer are not required to be set for each terminal, so that the technical problem of high test complexity caused by the fact that the mapping relation between the corresponding domain name and the IP address is configured for each network environment on the terminal is solved, and the technical effect of reducing the test complexity is achieved.
Preferably, the sending unit includes a determining subunit, configured to obtain, according to the first identifier and the second identifier, an IP address of the application server in the predetermined network and a port number of the first port, where the second identifier is further used to indicate the predetermined network where the application server is located; and the first sending subunit is used for sending the request data to the first port on the application server with the IP address through the second port.
And the terminal sends a second identifier to the proxy server, wherein the second identifier can indicate the preset network where the application server is located, namely the port number of the proxy server is used as the identifier indicating the preset network where the application server is located. The second identifier indicates a second port of the proxy server, the second port can indicate a predetermined network where the application server is located, request data is output to different networks through different ports of the proxy server, and the proxy server determines the IP address of the application server and the port number of the first port in the predetermined network according to the port number of the proxy server in the second identifier sent by the terminal.
At this time, the port number of the proxy server is used as an identifier of the predetermined network, and the request data output through the port corresponding to a certain port number is output to the predetermined network, that is, different networks can be distinguished through the port number. The terminal can be connected to the network corresponding to the port number by informing the proxy server of the port number of the proxy server outputting the request data, that is, the terminal can access different networks by sending the port numbers of different proxy servers to the proxy server, thereby realizing the switching of different networks.
As shown in table 1, the port number of the proxy server corresponding to the test environment is 8888, and the port number of the proxy server corresponding to the development environment is 6660. The port number of the proxy server carried in the request information sent by the terminal 101 is 8888, the proxy server 102 sends the request data of the terminal 101 to the application server through the port with the port number of 8888, the domain name of the application server requested to be accessed by the terminal 101 is imgcache. qq.com, and the IP address of the proxy server corresponding to the domain name is 10.130.24.31:80, the proxy server 102 sends the request data of the terminal to the application server 103 with the IP address 10.130.24.31 through the port with the port number of 8888, and the application server 103 is in a test environment.
The terminal informs the proxy server of the port number of the request data, and the proxy server sends the request data through the port corresponding to the port number sent by the terminal, so that the terminal can establish connection with the application server in the network environment corresponding to the port number. The terminal only needs to send the port number to the proxy server, does not need to separately configure the IP address and the port of the proxy computer for each test, and can configure the IP address and the port on the proxy server once, so that the technical problem of high test complexity caused by configuring the mapping relation between the corresponding domain name and the IP address for each network environment on the terminal in the prior art is solved, and the technical effect of reducing the test complexity is further achieved.
Preferably, the determining subunit comprises: and the obtaining module is used for obtaining the IP address under the preset network corresponding to the first identifier and the port number of the first port from the preset mapping relation of the preset network indicated by the second identifier.
Each network environment corresponds to a preconfigured mapping relationship, as shown in table 1, the network environment has a mapping relationship with a port number of the proxy server, and in each network environment, there is also a mapping relationship from a domain name of the application server in the network environment to an IP address. When the application servers requested by the same domain name are in different networks, the IP addresses of the application servers in the predetermined network are different from the IP addresses in other networks, so the domain name of the same application server may correspond to the IP address. As in table 1, the application server with the domain name imgcache. qq.com maps an IP address of 10.130.24.31 in the test environment, but maps an IP address of 10.185.20.211 in the development environment. The proxy server can acquire the IP address of the application server in the predetermined network and the port number of the first port according to the preset mapping relation of the predetermined network lock indicated by the second identifier.
In this embodiment, the port number of the proxy server is 6660, the first identifier is a domain name imgcache.qq.com of the application server, a network environment corresponding to the port number 6660 is a development environment, and in a preconfigured mapping relationship corresponding to the development environment, an IP address mapped by the domain name imgcache.qq.com is 10.185.20.211, and the port number of the first port is 80.
Preferably, the first identifier includes a network domain name of the application server or an initial IP address of the application server, and the first lookup sub-module is configured to lookup whether a mapping relationship under a predetermined network indicated by the second identifier exists in a preconfigured mapping relationship, where the proxy server stores mapping relationships under one network or at least two different networks in advance, and the mapping relationship under each network includes at least one of: mapping relation between network domain name and IP address and port number, and mapping relation between IP address and port number; and the second searching submodule is used for searching and sending the IP address under the preset network and the port number of the first port corresponding to the network domain name or the initial IP address included in the first identifier to the proxy server in the mapping relation under the preset network indicated by the second identifier when the mapping relation under the preset network indicated by the second identifier is searched.
If the first identification request is a network domain name, the proxy server searches a mapping relation between the network domain name and the IP address of the application server and the port number of the first port in the mapping relation; if the mapping relation under the predetermined network indicated by the second identification exists and the first identification request is the initial IP address, the proxy server searches the mapping relation between the initial IP address and the IP address of the application server and the port number of the first port.
For example, the second identification is a port number of the proxy server. The proxy server searches an IP address and a port number of a first port of the application server under a preset network according to the network domain name or the initial IP address of the application server, and sends request data of the terminal to the port corresponding to the first port number of the application server corresponding to the IP address searched by the proxy server.
The preconfigured mapping on the proxy server may be as shown in table 1.
As shown in table 1, taking a network environment as an example of a test environment and a development environment, a proxy server in the test environment sends request data through a port with a port number of 8888; the proxy server in the development environment sends the request data through a port with port number 6660. The second identifier may be a port number of the proxy server, different port numbers corresponding to different networks. For example, the port number of the proxy server corresponding to the development environment is 6660, and the port number of the proxy server corresponding to the test environment is 8888. The terminal can write the port number of the corresponding proxy server in the request message according to the required network environment, and the proxy server acquires the port number of the proxy server from the request message and then sends the request data from the port corresponding to the port number.
Specifically, the proxy server receives a network domain name, such as imgcache. qq.com, sent by the terminal, or an initial IP address, such as 172.25.32.202, of the application server.
After receiving the first identifier and the second identifier, the proxy server searches whether a mapping relation under a predetermined network indicated by the second identifier exists. For example, the second identifier is 8888, the proxy server searches the mapping corresponding to the port number 8888 in table 1, i.e., searches the mapping related to the first identifier in the test environment. If the first identification request is a network domain name, the mapping relationship between the network domain name and the IP address and the port number of the application server is searched in the test environment, for example, the network domain name is i.gtimg.cn, and its corresponding IP address is 10.130.24.31 and the port number is 80. If the first identifier carries an initial IP address and the second identifier carries a port number of 6660, the IP address of the application server mapped by the IP address 172.25.32.202, which cannot be found in the environment mapped by the initial IP address if the initial IP address is found in the development environment, is 10.130.25.95 and the port number of the application server is 8080. Since the first identifier may also carry a port number of the application server, in addition to the commonly used port number 80, a port number may be specified, for example, in table 1, the port number with an IP address of 172.25.32.202 is specified as 8080.
After the proxy server maps the first identifier sent by the terminal into the IP address and the port number of the application server according to the first identifier and the second identifier, the request data of the terminal is sent to the application server corresponding to the IP address and the port number obtained according to mapping. For example, in the development stage of an application, a terminal needs to be tested in a development environment, and the port number of a proxy server corresponding to the development environment is 6660. When the terminal sends the request message to the proxy server, the domain name of the application server to be accessed by the terminal is carried in the first identifier and is imgcache. qq.com, and the port number of the proxy server is carried in the second identifier and is 6660, then the proxy server finds the IP address corresponding to the domain name of the application server in the first identifier according to the port number 6660 carried in the second identifier, as can be seen from table 1, the IP address mapped by the domain name imgcache. qq.com in the development environment is 10.185.20.211, which is different from the IP address 10.130.24.31 in the test environment. And the proxy server sends the request information of the terminal to the application server corresponding to the IP address according to the IP address obtained by mapping, namely the proxy server sends the request data for accessing the application server with the domain name of imgcache. qq.com to the application server with the IP address of 10.185.20.211. The server is in a development environment, so that the sending terminal of the proxy server can access the application server with the domain name imgcache. If the development environment and the test environment are in the local area network and the terminal cannot directly access the application server accessed through the local area network, the application server in the local area network can be accessed through the transmission of the proxy server in the manner described above.
To further illustrate the method of testing the terminals according to the embodiments of the present invention, the following description is made with reference to fig. 1 and table 1.
The IP address of the proxy server to which the terminal 101 is connected is 113.108.17.145, and the port numbers of the two ports of the proxy server are 8888 and 6660, respectively, wherein the request data transmitted through the port number 8888 is transmitted to the first application server 103, and the request data transmitted through the port number 6660 is transmitted to the second application server 104. The first application server 103 and the second application server 104 both include a plurality of application servers, domain names of the plurality of application servers in the first application server 103 are imgcache.qq.com, i.gtimg.cn and p.qq.com, respectively, and the plurality of servers corresponding to the three domain names are in a test environment; the second application server 104 includes application servers with domain names imgcache.qq.com and i.gtimg.cn, respectively, and an application server with an IP address of 172.25.32.202, which are in a development environment.
If the port number carried by the terminal is 8888, the proxy server determines that the IP address of the application program corresponding to the requested domain name i.gtimg.cn is 10.130.24.31 according to the port number, and the proxy server sends the IP address obtained by mapping back to the proxy server; if the terminal carries a port number 6660, the proxy server determines that the IP address of the application server corresponding to the requested domain name i.gtimg.cn is 10.185.20.211 according to the port number, and after the proxy server acquires the IP address of the application server, the proxy server sends the request data to the determined IP address and the port corresponding to the port number of the application server corresponding to the port number, so as to establish the connection between the terminal and the application server for testing.
In the embodiment, after the proxy server receives the second identifier sent by the terminal, the proxy server determines the IP address of the application server corresponding to the domain name in the first identifier according to the second port in the second identifier, and the proxy server obtains the IP address through mapping, and sends the request data of the terminal to the application server with the IP address. Because the proxy server has a mapping relation between the IP address of the application server and the port number of the proxy server, and the ports of the proxy server correspond to different network environments, the proxy server can find the IP address of the application server according to the port number and the domain name, and send the request data of the terminal to the application server corresponding to the IP address, so that the proxy server can connect the terminal to the network environment to be tested according to the port number of the second port of the terminal and the identifier for indicating the address of the application server, no matter the port numbers of a plurality of different second ports sent by one terminal or the port numbers of the same or different second ports sent by a plurality of terminals, the proxy server can connect the terminals to the network environment requested by the terminal, if the network environment needs to be switched, the terminal only needs to change the port number of the second port in the second identifier, the information on the proxy server does not need to be changed, so that the technical problem of high test complexity caused by the fact that the mapping relation between the corresponding domain name and the IP address is configured for each network environment on the terminal is solved, and the technical effect of reducing the test complexity is achieved.
Preferably, the receiving unit includes a receiving subunit, configured to receive request messages sent by the plurality of terminals for accessing the application server; the sending unit comprises a second sending subunit, configured to send, through multiple threads, request data in request messages sent by multiple terminals, where each thread is used to send request data in a request message sent by one terminal.
In order to ensure that the terminal can access the proxy server, the IP address of the proxy server is the IP address that the terminal can access, that is, the terminal can access the proxy server through the network.
When the proxy server receives request information for accessing the application server sent by a plurality of terminals, the proxy server can simultaneously process request data from the terminals through a plurality of threads, and each thread sends the request data in the request information sent by one assembly section. The proxy server sends the request data, so that the consumption of the memory of the proxy server is not too large, and the requirement of simultaneously sending the request data from the terminal by using a plurality of threads can be met.
By the embodiment, the request data from the terminal is processed by the multiple threads, the requirement of switching the test environments of the multiple terminals can be met, and the efficiency of switching the test environments of the terminals is improved.
Preferably, the proxy server further comprises: the second acquisition unit is used for acquiring the IP address of the terminal and the IP section which is allowed to be accessed by the terminal by the proxy server after the proxy server receives the request message which is sent by the terminal and used for accessing the application server; the judging unit is used for judging whether the IP address of the terminal is in the IP section which is allowed to be accessed by the proxy server; and when the IP address of the terminal is judged to be in the IP section which is allowed to be accessed by the proxy server, the notification sending unit sends the request data to the first port on the application server.
After receiving a request message sent by a terminal for accessing an application server, a proxy server acquires an IP address of the terminal and an IP section which is allowed to be accessed by the terminal and is allowed by the proxy server, and if the IP address of the terminal which requests to be connected with the proxy server is in the IP section which is allowed to be accessed by the terminal and is allowed by the proxy server, the proxy server forwards request data to a first port on the application server. That is, before the terminal accesses the application server, the terminal outside the IP segment allowing access to the application program can be intercepted to avoid malicious connection of the terminal, thereby ensuring the security of the proxy server and the application server.
Example 3
According to an embodiment of the present invention, there is also provided a proxy server for implementing the terminal testing method, as shown in fig. 6, the proxy server mainly includes a processor 601, a device interface 602, a network interface 603, and a memory 604, where:
the device interface 602 is used for connecting a terminal, the network interface 603 is used for connecting an application server, and the memory 604 is used for storing program codes for executing the above-described terminal test method.
The processor 601 is mainly configured to perform the following operations:
the processor 601 is configured to receive a request message sent by a terminal for accessing an application server, where the request message includes: the first identification is used for indicating the IP address and the first port of the application server, and the second identification is used for indicating the second port of the proxy server; the proxy server acquires a first identifier and a second identifier from the request message; and the proxy server sends the request data in the request message to the first port on the application server with the IP address through the second port indicated by the second identification.
The processor 601 is further configured to obtain an IP address of the application server in the predetermined network and a port number of the first port according to the first identifier and the second identifier, where the second identifier is further configured to indicate the predetermined network where the application server is located; the proxy server sends the request data to the first port on the application server addressed to the IP address through the second port.
The processor 601 is further configured to obtain an IP address and a port number of the first port in the predetermined network corresponding to the first identifier from a mapping relationship preconfigured for the predetermined network indicated by the second identifier.
The processor 601 is further configured to find whether there is a predetermined mapping relationship under the network indicated by the second identifier, where the mapping relationship under one network or at least two different networks is pre-stored in the proxy server, and the mapping relationship under each network includes at least one of the following: mapping relation between the network domain name and the IP address and port number of the application server, and mapping relation between the initial IP address and the IP address and port number of the application server; if the mapping relation under the predetermined network indicated by the second identifier is found, the proxy server searches the IP address under the predetermined network and the port number of the first port corresponding to the network domain name or the initial IP address included in the first identifier in the mapping relation under the predetermined network indicated by the second identifier.
The processor 601 is further configured to receive request messages sent by a plurality of terminals for accessing the application server; the step of sending the request data in the request message to the first port on the application server with the IP address through the second port indicated by the second identifier comprises the following steps: the proxy server sends request data in request messages sent by a plurality of terminals through a plurality of threads, wherein each thread is used for sending the request data in the request message sent by one terminal.
The processor 601 is further configured to obtain an IP address of the terminal after the proxy server receives a request message sent by the terminal for accessing the application server; judging whether the IP address of the terminal is in an IP section which is allowed to be accessed by the proxy server; and if the IP address of the terminal is in the IP section which is allowed to be accessed by the proxy server, the proxy server executes the operation of sending the request data to the first port on the application server.
Optionally, the specific examples in this embodiment may refer to the examples described in embodiment 1 and embodiment 2, and this embodiment is not described herein again.
Example 4
The embodiment of the invention also provides a storage medium. Optionally, in this embodiment, the storage medium may be configured to store the program code of the terminal testing method according to this embodiment of the present invention
Optionally, in this embodiment, the storage medium may be located in at least one of a plurality of network devices in a network of a wide area network, a metropolitan area network, or a local area network.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps:
s1, the proxy server receives a request message sent by the terminal for accessing the application server, where the request message includes: the first identification is used for indicating the IP address and the first port of the application server, and the second identification is used for indicating the second port of the proxy server;
s2, the proxy server obtains the first identification and the second identification from the request message;
and S3, the proxy server sends the request data in the request message to the first port on the application server with the IP address through the second port indicated by the second identifier.
Optionally, in this embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
Optionally, in this embodiment, the processor executes, according to the program code stored in the storage medium: the proxy server sends the request data in the request message to the first port on the application server with the IP address through the second port indicated by the second identifier, and the method comprises the following steps: the proxy server obtains an IP address of the application server under a preset network and a port number of a first port according to the first identifier and the second identifier, wherein the second identifier is also used for indicating the preset network where the application server is located; the proxy server sends the request data to the first port on the application server addressed to the IP address through the second port.
Optionally, in this embodiment, the processor executes, according to the program code stored in the storage medium: the proxy server obtaining the IP address and the port number of the first port of the application server under the preset network according to the first identifier and the second identifier comprises: and the proxy server acquires the IP address under the preset network corresponding to the first identifier and the port number of the first port from the mapping relation preset for the preset network indicated by the second identifier.
Optionally, in this embodiment, the processor executes, according to the program code stored in the storage medium: the first identifier includes a network domain name of the application server or an initial IP address of the application server, and the proxy server obtains the IP address and the port number of the first port under the predetermined network corresponding to the first identifier from a mapping relation preconfigured for the predetermined network indicated by the second identifier includes: the proxy server searches whether a predetermined mapping relation under the network indicated by the second identifier exists, wherein the mapping relation under one network or at least two different networks is stored in the proxy server in advance, and the mapping relation under each network comprises at least one of the following: mapping relation between the network domain name and the IP address and port number of the application server, and mapping relation between the initial IP address and the IP address and port number of the application server; if the mapping relation under the predetermined network indicated by the second identifier is found, the proxy server searches the IP address under the predetermined network and the port number of the first port corresponding to the network domain name or the initial IP address included in the first identifier in the mapping relation under the predetermined network indicated by the second identifier.
Optionally, in this embodiment, the processor executes, according to the program code stored in the storage medium: the method for receiving the request message for accessing the application server sent by the terminal by the proxy server comprises the following steps: the method comprises the steps that a proxy server receives request messages sent by a plurality of terminals and used for accessing an application server; the proxy server sends the request data in the request message to the first port on the application server with the IP address through the second port indicated by the second identifier, and the method comprises the following steps: the proxy server sends request data in request messages sent by a plurality of terminals through a plurality of threads, wherein each thread is used for sending the request data in the request message sent by one terminal.
Optionally, in this embodiment, the processor executes, according to the program code stored in the storage medium: after the proxy server receives a request message for accessing the application server, which is sent by the terminal, the terminal testing method further includes: the proxy server acquires the IP address of the terminal; the proxy server judges whether the IP address of the terminal is in the IP section which is allowed to be accessed by the proxy server; and if the IP address of the terminal is in the IP section which is allowed to be accessed by the proxy server, the proxy server executes the operation of sending the request data to the first port on the application server.
Optionally, the specific examples in this embodiment may refer to the examples described in embodiment 1 and embodiment 2, and this embodiment is not described herein again.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (13)

1. A terminal testing method is characterized by comprising the following steps:
the method comprises the following steps that a proxy server receives a request message which is sent by a terminal and used for accessing an application server, wherein the request message comprises: a first identifier and a second identifier, wherein the first identifier is used for indicating an IP address and a first port of the application server, the second identifier is used for indicating a second port of the proxy server, a port number of the second port is used for indicating a predetermined network where the application server is located, the proxy server switches the predetermined network by receiving the port number of the second port, and a mapping relation is formed between the port number of the proxy server and the IP address of the application server;
the proxy server acquires the first identifier and the second identifier from the request message; and
and the proxy server sends the request data in the request message to the first port on the application server with the IP address through the second port indicated by the second identifier.
2. The terminal test method according to claim 1, wherein the sending, by the proxy server, the request data in the request message to the first port on the application server addressed to the IP address through the second port indicated by the second identifier comprises:
the proxy server obtains the IP address and the port number of the first port of the application server under the preset network according to the first identifier and the second identifier;
and the proxy server sends the request data to the first port on the application server with the IP address through the second port.
3. The terminal test method according to claim 2, wherein the obtaining, by the proxy server, the IP address and the port number of the first port of the application server in a predetermined network according to the first identifier and the second identifier comprises:
the proxy server acquires the IP address and the port number of the first port under the predetermined network corresponding to the first identifier from a mapping relation preconfigured for the predetermined network indicated by the second identifier.
4. The terminal test method according to claim 3, wherein the first identifier includes a network domain name of the application server or an initial IP address of the application server, and the obtaining, by the proxy server, the IP address and the port number of the first port in the predetermined network corresponding to the first identifier from a mapping relationship preconfigured for the predetermined network indicated by the second identifier includes:
the proxy server searches whether the mapping relation under the predetermined network indicated by the second identifier exists, wherein the mapping relation under one network or at least two different networks is pre-stored in the proxy server, and the mapping relation under each network comprises at least one of the following: mapping relation between the network domain name and the IP address and port number of the application server, and mapping relation between the initial IP address and the IP address and port number of the application server;
if the mapping relationship under the predetermined network indicated by the second identifier is found, the proxy server searches the IP address under the predetermined network and the port number of the first port corresponding to the network domain name or the initial IP address included in the first identifier in the mapping relationship under the predetermined network indicated by the second identifier.
5. The terminal test method according to claim 1,
the method for receiving the request message for accessing the application server sent by the terminal by the proxy server comprises the following steps: the proxy server receives request messages sent by a plurality of terminals and used for accessing an application server;
the sending, by the proxy server, the request data in the request message to the first port on the application server addressed to the IP address through the second port indicated by the second identifier includes: the proxy server sends request data in request messages sent by a plurality of terminals through a plurality of threads, wherein each thread is used for sending the request data in the request message sent by one terminal.
6. The terminal test method according to claim 1, wherein after the proxy server receives a request message for accessing the application server sent by the terminal, the terminal test method further comprises:
the proxy server acquires the IP address of the terminal;
the proxy server judges whether the IP address of the terminal is in the IP section which is allowed to be accessed by the proxy server; and
and if the IP address of the terminal is in the IP section which is allowed to be accessed by the proxy server, the proxy server executes the operation of sending the request data to the first port on the application server.
7. A proxy server, comprising:
a receiving unit, configured to receive a request message sent by a terminal and used for accessing an application server, where the request message includes: a first identifier and a second identifier, wherein the first identifier is used for indicating an IP address and a first port of the application server, the second identifier is used for indicating a second port of the proxy server, a port number of the second port is used for indicating a predetermined network where the application server is located, the proxy server switches the predetermined network by receiving the port number of the second port, and a mapping relation is formed between the port number of the proxy server and the IP address of the application server;
a first obtaining unit, configured to obtain the first identifier and the second identifier from the request message; and
a sending unit, configured to send, through the second port indicated by the second identifier, request data in the request message to the first port on the application server addressed to the IP address.
8. The proxy server according to claim 7, wherein the sending unit includes:
a determining subunit, configured to obtain, according to the first identifier and the second identifier, the IP address and the port number of the first port of the application server in the predetermined network;
and the first sending subunit is configured to send the request data to the first port of the application server addressed to the IP address through the second port.
9. The proxy server of claim 8, wherein the determining subunit comprises:
an obtaining module, configured to obtain the IP address and the port number of the first port in the predetermined network corresponding to the first identifier from a mapping relationship preconfigured for the predetermined network indicated by the second identifier.
10. The proxy server of claim 9, wherein the first identifier comprises a network domain name of the application server or an initial IP address of the application server, and wherein the obtaining module comprises:
a first searching sub-module, configured to search whether a mapping relationship under the predetermined network indicated by the second identifier exists, where the mapping relationship under one network or at least two different networks is pre-stored in the proxy server, and the mapping relationship under each network includes at least one of the following: mapping relation between the network domain name and the IP address and port number of the application server, and mapping relation between the initial IP address and the IP address and port number of the application server; and
a second searching submodule, configured to, when the mapping relationship in the predetermined network indicated by the second identifier is found, search, by the proxy server, an IP address and a port number of the first port in the predetermined network, which correspond to the network domain name or the initial IP address included in the first identifier, in the mapping relationship in the predetermined network indicated by the second identifier.
11. The proxy server of claim 7,
the receiving unit includes: the receiving subunit is used for receiving request messages sent by a plurality of terminals and used for accessing the application server;
the transmission unit includes: and the second sending subunit is configured to send, through multiple threads, request data in request messages sent by multiple terminals, where each thread is used to send request data in the request message sent by one terminal.
12. The proxy server of claim 7, further comprising:
the second acquisition unit is used for acquiring the IP address of the terminal by the proxy server after the proxy server receives a request message which is sent by the terminal and used for accessing the application server; and
a judging unit, configured to judge whether the IP address of the terminal is in an IP segment that the proxy server allows access to; and when the IP address of the terminal is judged to be in the IP section which is allowed to be accessed by the proxy server, informing the sending unit to execute the operation of sending the request data to the first port on the application server.
13. A storage medium, in which a computer program is stored, wherein the computer program is arranged to perform the method of any of claims 1 to 6 when executed.
CN201410438024.5A 2014-08-29 2014-08-29 Terminal testing method and proxy server Active CN105376107B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410438024.5A CN105376107B (en) 2014-08-29 2014-08-29 Terminal testing method and proxy server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410438024.5A CN105376107B (en) 2014-08-29 2014-08-29 Terminal testing method and proxy server

Publications (2)

Publication Number Publication Date
CN105376107A CN105376107A (en) 2016-03-02
CN105376107B true CN105376107B (en) 2020-02-28

Family

ID=55377934

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410438024.5A Active CN105376107B (en) 2014-08-29 2014-08-29 Terminal testing method and proxy server

Country Status (1)

Country Link
CN (1) CN105376107B (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106953789B (en) * 2017-02-20 2020-02-04 广州启生信息技术有限公司 Method for realizing programmable multi-dial routing outlet visiting system
CN107070931B (en) * 2017-04-21 2020-08-18 北京奇安信科技有限公司 Cloud application data uploading/accessing method and system and cloud proxy server
CN107105033B (en) * 2017-04-21 2020-08-18 北京奇安信科技有限公司 Cloud application access method, cloud proxy server and cloud application access system
CN109525628B (en) * 2017-09-20 2021-09-07 北京国双科技有限公司 HTTP request debugging method, device and system
CN108153543B (en) * 2017-12-29 2021-03-02 北京酷我科技有限公司 Server address switching method
CN107948329A (en) * 2018-01-03 2018-04-20 湖南麓山云数据科技服务有限公司 A kind of cross-domain processing method and system
CN109194749B (en) * 2018-09-11 2021-08-03 福建天泉教育科技有限公司 Method for monitoring network request and storage medium
CN111225099B (en) * 2018-11-27 2021-07-13 Oppo(重庆)智能科技有限公司 Terminal test method, server, test equipment and storage medium
CN109634858A (en) * 2018-12-07 2019-04-16 北京小米移动软件有限公司 File test method, device and computer readable storage medium
CN109582583B (en) * 2018-12-14 2024-06-18 平安健康保险股份有限公司 Software testing method, device, computer equipment and storage medium
CN111131436B (en) * 2019-12-20 2022-08-30 广州品唯软件有限公司 Method and device for quickly searching proxy and readable storage medium
CN113676502B (en) * 2020-05-14 2024-05-14 协鑫集成科技股份有限公司 Application service access method, device and storage medium
CN113783713A (en) * 2020-08-04 2021-12-10 北京沃东天骏信息技术有限公司 Method, device and system for configuring proxy
CN112261660B (en) * 2020-10-16 2024-06-04 深圳安软信创技术有限公司 Android mobile phone end application proxy access security control method
CN114520780A (en) * 2022-01-28 2022-05-20 北京金堤科技有限公司 Access method and device for proxy server
CN115277119B (en) * 2022-07-12 2024-02-09 深圳市电子商务安全证书管理有限公司 Access method, device, equipment and storage medium of internal network

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102227115A (en) * 2011-06-13 2011-10-26 北京星网锐捷网络技术有限公司 Method and device for limiting user access
CN103944942A (en) * 2013-01-22 2014-07-23 腾讯科技(深圳)有限公司 Multi-WEB environment data access method and device
CN104009880A (en) * 2013-02-27 2014-08-27 阿里巴巴集团控股有限公司 Web test method, proxy server and Web test device
US9246699B2 (en) * 2010-06-07 2016-01-26 Salesforce.Com, Inc. Method and system for testing multiple components of a multi-tenant, multi-domain, multi-tiered website

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102591667B (en) * 2012-01-16 2015-05-27 深圳市同洲电子股份有限公司 Method and device for remote publishing application

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9246699B2 (en) * 2010-06-07 2016-01-26 Salesforce.Com, Inc. Method and system for testing multiple components of a multi-tenant, multi-domain, multi-tiered website
CN102227115A (en) * 2011-06-13 2011-10-26 北京星网锐捷网络技术有限公司 Method and device for limiting user access
CN103944942A (en) * 2013-01-22 2014-07-23 腾讯科技(深圳)有限公司 Multi-WEB environment data access method and device
CN104009880A (en) * 2013-02-27 2014-08-27 阿里巴巴集团控股有限公司 Web test method, proxy server and Web test device

Also Published As

Publication number Publication date
CN105376107A (en) 2016-03-02

Similar Documents

Publication Publication Date Title
CN105376107B (en) Terminal testing method and proxy server
CN105391811B (en) domain name resolution method, access method of application server and terminal thereof
US10397120B2 (en) Service link selection control method and device
US9467937B2 (en) System and method of locating wireless connection among a plurality of wireless connections
US10165507B2 (en) Network access method and apparatus applied to mobile application
US20170289243A1 (en) Domain name resolution method and electronic device
CN110267314B (en) Method and device for switching network slices
CN110688146A (en) Method, device and storage medium for dynamically configuring monitoring system
CN106851758B (en) Communication network switching method and terminal equipment
CN104270204A (en) Testing method and testing equipment for wireless communication module
CN105516744B (en) Smart television access method and smart television access system
CN111314394B (en) Resource publishing method, device, equipment and storage medium of Internet of things
CN103561063A (en) Method and terminal for logging onto set top box
CN114416508A (en) Application performance monitoring method and device, storage medium and electronic equipment
US20150121364A1 (en) Method, User Equipment, and Application Server for Downloading Application
US20150039917A1 (en) Information processing device, activation method, and computer program product
CN110730244A (en) Networking method and system of DHT (distributed hash table) system, network equipment and storage medium
CN108768807B (en) Virtual-real interconnection method and device for cloud platform
CN111026995A (en) Method and device for information association between applications and storage medium
CN108614844B (en) Multimedia file generation method and device
CN109660497A (en) Data processing method and device, terminal, processor, storage medium
CN114301989A (en) Information transmission method, device and system
CN102891888B (en) Data access method and related equipment and system
CN113746909A (en) Network connection method, device, electronic equipment and computer readable storage medium
CN106534096A (en) Method for master device to share user identity with slave device, master device, and slave device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant