Anda di halaman 1dari 80



1.1 OVERVIEWS AND ISSUES INVOLVED Overview of proxy server:

Proxy Server Overview:

Proxy Server enables you to connect the private network or LAN to a public network such as the Internet, by acting as a gateway for internal client computers to the Internet. Proxy Server is a secure gateway which you can use to provide Internet connectivity for IP and IPX based networks. A gateway is a computer that makes it possible for two networks to communicate. Proxy Server services should run on one computer to which both the private network and the public network is connected to. The computer running the Proxy Server services should have two network interfaces:

A network interface that points to the public network.

A network interface that points to the private network.

The operations of Proxy Server are transparent to client computers. This means that users are not aware that the Proxy Server is actually requesting content on the Internet on their behalf. Users only becomes aware of the presence of the Proxy Server when they request content that the Proxy Server has been configured to disallow. The Web server servicing the request for content processes these requests as if they originated from the actual users. Microsoft Proxy Server version 2.0 is an extensible firewall and content cache server. Proxy Server version 2.0 provides Internet security, faster Internet access, caching services and improves network response time. Proxy Server can locally cache Internet sites and files which are frequently requested. These requests are then serviced from the local cache. This leads to an increase in Internet performance. Proxy Server can provide network address translation to support private IP addressing. Proxy Server includes a number of services which administrators can utilize to manage and control connections to the Internet. You can limit the Web sites that users can access. You can also prevent unauthorized Internet users from accessing the private network. When Proxy Server is used as a gateway to the Internet, unauthorized Internet users are basically prevented from accessing the private network. This is due to Proxy Server being the barrier between the private network and public network requests for content on the Internet is allowed, and unauthorized access from the Internet is blocked. You can however use the reverse proxy feature to provide Internet users with the ability to access Web sites on the network via the Proxy Server.

Issues of proxy server:

When proxy servers go down, the calls seem to come all at once. "Is there a problem with the proxy server?" "I can't get to my Web site." "I keep getting this message saying the computer can't find the server." Admittedly, many browsers and proxy servers don't explain to users what went wrong with their request. However, you can categorize nearly every proxy server problem into one of four categories:

The browser or client is misconfigured. The URL or Web site is down. Connectivity or network problems exist. An actual proxy server problem exists.

Local Connectivity and Network Issues:

Network problems are common problems that every proxy server administrator faces. Even the proxy servers with the highest availability rates still have to account for Web servers on the Internet that are down. If the remote site is down or inaccessible, it's often up to the administrator to break the bad news to end users. You can quickly eliminate the proxy server from this picture by asking a user to go to another Web site. Note that although the site appears, it might be coming from the cache. To ensure that the proxy server is loading a fresh copy from the Web server, ask the user to hold down Ctrl+Shift and click Refresh (if the client is using IE). One common problem during setup is the presence of multiple default gateways. This problem generates a 10060 error (Connection Timed Out) to any request sent to the Web Proxy service. Though this error is often associated with slow external links to the Internet, if it occurs right after setup, more than one default gateway is probably present.

Proxy server administrators often see event ID 120 in the proxy server's event log. The event's description is The Proxy Service could not create a packet filter. This message is typical on busy proxy servers with packet filtering enabled. The purpose of the message is to alert the administrator that the packet filter dropped more than 20 packets.

Possible issues with caching:

Caching rightnow Service URLs on your proxy server may result in the issues below: 1. Users get time out errors when performing tasks. 2. Users get partial page loads. 3. Staff Users can open answers and incidents for editing, but when the session times out or they leave the page, they can no longer get in. User must clear the temporary Internet files in order to get in again. 4. Issues are intermittent and cannot be reproduced on demand.

Troubleshooting Tips:
Caching issues with your browser may cause intermittent results as well. Try clearing the cache in your browser. In Internet Explorer, use the steps below: 1. Select Tools -> Internet Options 2. Under Temporary Internet Files, select Delete Files. 3. Click OK.

You may also change the browser to always request a new page. In Internet Explorer, use the following steps: 1. Select Tools -> Internet Options 2. Under Temporary Internet Files, select Settings. 3. Under Check for new versions of stored pages, select Every visit to the page. 4. Click OK.


A computer network, often simply referred to as a network, is a collection of computers and devices interconnected by communications channels that facilitate communications and allows sharing of resources and information among interconnected devices. Networks may be classified according to a wide variety of characteristics such as topology, connection method and scale.

You have undoubtedly heard the the whole is greater than the sum of its parts. This phrase describes networking very well, and explains why it has become so popular. A network isn't just a bunch of computers with wires running between them. Properly implemented, a network is a system that provides its users with unique capabilities, above and beyond what the individual machines and their software applications can provide.

Most of the benefits of networking can be divided into two generic categories: connectivity and sharing. Networks allow computers, and hence their users, to be connected together. They also allow for the easy sharing of information and resources, and cooperation between the devices in other ways. Since modern business depends so much on the intelligent flow and management of information, this tells you a lot about why networking is so valuable

But, networking has a few drawbacks that balance against its many positive aspects. Setting up a network has costs in hardware, software, maintenance and administration. It is also necessary to manage a network to keep it running smoothly, and to address possible misuse or abuse. Data security also becomes a much bigger concern when computers are connected together. In such a large network, our system becomes exposed. Hence, there are chances of some of the problems such as, unauthorized access, virus attack, speed etc. Such disadvantages define our problem domain.


In order to reduce the risks associated with networking, of which security is the main, many techniques have been in use. One of the methods used is setting of a proxy server. Now, let us see what this proxy server is.

In computer networks, a proxy server is a server (a computer system or an application program) that acts as an intermediary for requests from clients seeking resources from other servers. A proxy is a stand-in for you - someone who does something on your behalf. As the name proxy, it means a server which fills up or acts and provides functionalities of some other server. In an enterprise that uses the Internet, a proxy server is a server that acts as an intermediary between a workstation user and the Internet.


Relays and caches FTP Traffic.

2. HTTP Proxy Server:

A one way request to retrieve Web Pages.

3. Socks Proxy Server:

A newer protocol to allow relaying of far more different types of data, whether TCP or UDP.

4. NAT Proxy Server:

This one works a little different, it allows the redirection of all packets without a Program having to support a Proxy Server.

5. SSL Proxy Server:

An extension was created to the HTTP Proxy Server which allows relaying of TCP data similar to a Socks Proxy Server. This one done mainly to allow encryption of Web Page requests. Furthermore, a Proxy Server can be split into another two Categories:

An Anonymous Proxy Server blocks the remote Computer from knowing the identity of the Computer using the Proxy Server to make

7. Transparent:
A Transparent Proxy Server tells the remote Computer the IP Address of your Computer. This provides no privacy. Anonymous Proxy Servers can further be broken down into two more categories, Elite and Disguised. An Elite Proxy Server is not identifiable to the remote computer as a Proxy in any way. A Disguised Proxy Server gives the remote computer enough information to let it know that it is a Proxy, however it still does not give away the IP of the Computer it is relaying information for.



Proxy Server provides a secure gateway to the Internet. It acts as the control point between the private network and the Internet. Only a single secure gateway or control point needs to be managed, and you can also control the flow of traffic at the Proxy Server.

Numerous users can utilize the single Internet connection provided by Proxy Server. This leads to cost savings with regard to modems, telephone lines, and so forth.

The IP addresses utilized on the private network are not revealed on the Internet. When users on the private network request content on the Internet, the public IP address of the Proxy Server is used, and not the private IP addresses. In this way, private IP addresses are never visible on the Internet or used on the Internet

Because of the Proxy Server has two network interface cards, the LAN is secured from unauthorized users attempting to access the private network. Only one point of contact exists between the private network and the Internet.

Proxy Server 2.0 provides a dynamic packet filtering feature that enables you to block specific packet types through ports.

Proxy Server can locally cache Internet sites and files which are frequently requested. Subsequent requests for these Internet sites are then serviced from the local cache. Cached information is accessed by users from a location on the Local Area Network (LAN). This means that bandwidth utilization to the Internet ends up being lowered because cached information does not need to be downloaded from the Internet. All of this leads to an improvement in the service experienced by users.

Proxy Server, by default, provides network address translation between the private network and the Internet. This basically means that Proxy Server supports private IP addressing schemes and public addressing.

Proxy Server also provides a feature called proxy arrays. A proxy array is a solution whereby one or multiple proxy servers operate as a single cache for client requests. Benefits provided by the proxy array feature include scalable performance, and fault tolerance.

Clients running WinSock and SOCKS applications can use TCP/IP or IPX/SPX to access the Internet via Proxy Server.

Proxy Server also includes Web publishing support. You can utilize the reverse proxy feature to provide Internet users with the ability to access Web servers hosted on the network through the Proxy Server. Reverse hosting takes place when multiple Web servers are able to publish to the Internet.


Access to the Internet can be based on users, or groups of users. Proxy Server can provide different types of access to the Internet, based on each group of users.

You can limit the Web sites that users can access.

Internet usage for each user can be tracked and logged.

Implementations of proxies:

Web proxy:
A proxy that focuses on World Wide Web traffic is called a "web proxy". The most common use of a web proxy is to serve as a web cache. Most proxy programs provide a means to deny access to URLs specified in a blacklist, thus providing content filtering. This is often used in a corporate, educational, or library environment, and anywhere else where content filtering is desired. Some web proxies reformat web pages for a specific purpose or audience, such as for cell phones and PDAs.

Suffix proxies:
A suffix proxy server allows a user to access web content by appending the name of the proxy server to the URL of the requested content (e.g. ""). Suffix proxy servers are easier to use than regular proxy servers.

Transparent proxies:

An intercepting proxy (also forced proxy or transparent proxy) combines a proxy server with a gateway or router (commonly with NAT capabilities). Connections made by client browsers through the gateway are diverted to the proxy without client-side configuration (or often knowledge). Connections may also be diverted from a SOCKS server or other circuitlevel proxies. A security flaw in the way that transparent proxies operate was published by Robert Auger in 2009 and advisory by the Computer Emergency Response Team was issued listing dozens of affected transparent, and intercepting proxy servers.

Implementation Methods:

Interception can be performed using Cisco's WCCP (Web Cache Control Protocol). This proprietary protocol resides on the router and is configured from the cache, allowing the cache to determine what ports and traffic is sent to it via transparent redirection from the router. This redirection can occur in one of two ways: GRE Tunneling (OSI Layer 3) or MAC rewrites (OSI Layer 2). Once traffic reaches the proxy machine itself interception is commonly performed with NAT (Network Address Translation). Such setups are invisible to the client browser, but leave the proxy visible to the web server and other devices on the Internet side of the proxy. Recent releases of Linux and some BSD provide TPROXY (Transparent Proxy) which performs IP-level (OSI Layer 3) transparent interception and Spoofing of outbound traffic. Hiding the proxy IP address from other network devices.



Start by defining our Proxy class with the required imports, indicating to other classes that it may throw an IOException: import* ; import* ; import java.lang.* ; import java.util.* ;

class Proxy { public static void main(String args[]) throws IOException{

} } Read the local port, remote machine name and remote port as command line arguments (in that order): This is done by by parsing the commands entered by the user when the Proxy Server is initailly started, picking off each peice. The local port number is parsed first, followed by the remote host name, and finaly the remote port address. Each of these were checked for legality, and passed to the rest of the program if acceptable. If any were invalid, the program would exit and report the appropriate error.


Check the parameters for validity: Each of these were checked for legality, and passed to the rest of the program if acceptable. If any were invalid, the program would exit and report the appropriate error.

Create a socket and accept TCP requests on the local port: This is accomplished by creating a new Server Socket Server, from the ServerSocket Class. The port which it listens on is the one passed by the user on the command line. An Accepting socket is created by using the Accept() method of the Server Socket Class. This port is now ready to begin accepting TCP requests. Create two threads: This is done by implementing a new Class, ProxyThread which extends the Thread Class, and creating 2 new proxyThreads, which accept Sockets as their parameters. The Sockets that are passed are the Incoming and Outgoing Sockets, in that order. The Run() method of the Thread Class is overwritten, and does the actual data stream transferring, by the use of the OutputStream object, and the IpnutStream object of the Socket Class. The Proxy accepts data on the InputStream with the use of the Read() method, and stores it in a buffer. It then sends this buffer on the OutputStream with the use of the Write() methods of that sream. One to handle each of the following: Read an unknown amount data from the local port and forward it to the remote port: This is done by passing the incoming and outgoing port (in that order) to the proxyThread constructor. This creates a Listening Socket on the Proxy Server, listening on the local port, and a Sending Socket, directed to the Server who is serving the requests.


The amount of data read at each instant is printed to the screen where the proxy is running. Read an unknown amount of data from the remote port and forward it to the local port: In this case, the proxyThread class is sent the Socket parameters in the reverse order. The Listening Socket (first parameter) is the socket connected to the Server, and the Sending Socket (second parameter) is connected to the local port of the Client. The amount of data read at each instant is printed to the screen where the proxy is running.

Close the sockets if either closes or an exception occurs: If any type of error is detected while the server is either started or running, it will immediately close all sockets, and terminate itself. If either the Client or the Server close their connections to the other, the Proxy Server will also close all sockets and terminate itseslf. It knows if either the Client or Server has disconnected because a -1 is sent. The Proxy Server listens, waiting for this to be sent, and when it is encountered, all sockets are closed. Correctly terminate the threads: Again, if any type of error is detected while the server is either started or running, it will immediately end all threads, and terminate itself. If either the Client or the Server close their connections to the other, the Proxy Server will also end all threads and terminate itseslf. It knows if either the Client or Server has disconnected because a -1 is sent. The Proxy Server listens, waiting for this to be sent, and when it is encountered, all threads are closed. After the sockets are closed, connect more clients without re-starting the proxy: Once the server is started it will continualy listen for new connections on the port it is listening to. Therefore, if one connection is ended, thereby closing the sockets and terminating the threads, the Proxy Server will still

be active, listening for more users to connect. It does not need to be restarted in order to be connected to by more clients, because it runs independently, with or without users currently using it. Complete each of these tasks for multiple concurrent users: Because the server creates a new pair of threads for each client which attempts to connect to it, it can support multiple concurrent users simultaneously without any problem.


How Proxy Servers Works :

1. When a computer on the intranet makes a request out to the Internetsuch as to retrieve a Web page from a Web server-the internal computer actually contacts the proxy server, which in turn contacts the Internet server. The Internet server sends the Web page to the proxy server, which then forwards the page to the computer on the intranet. 2.Whenever a user connects to the Internet using a client application configured to use a proxy server, the application will first connect to the proxy server and give it its request. The proxy server then connects to the server which the client application wants to connect to and sends that server the request. Next, the server gives its reply to the proxy, which then finally sends it to the application client.

3. Proxy servers log all traffic between the Internet and the intranet. For example, a Telnet proxy server could track every single keystroke hit in every Telnet session on the intranet-and could also track how the external server on the Internet reacts to those keystrokes. Proxy servers can log every IP address, date and time of access, URL, number of bytes downloaded, and so on. This information can be used to analyze any

attacks launched against the network. It can also help intranet administrators build better access and services for employees. 4. Some proxy servers must work with special proxy clients. A more popular approach is to use off-the-shelf clients such as Netscape with proxy servers. When such an off-the-shelf package is used, it must be specially configured to work with proxy servers from a configuration menu. Then the intranet employee uses the client software as usual. The client software knows to go out to a proxy server to get the data, instead of to the Internet.

Diagram depicting what is a proxy Server


In a LAN, it is needed that there should be some security provided by the administrator and that some unauthorized sites should not be shown to that client in LAN. It was needed to decrease the web page access time so that those web pages that have been accessed earlier should not be asked from the web directly.

Following points are to be considered in feasibility study:

Mechanism for Client Server communication Browser Connection to server Cache management



Building proxy server for LAN does not require any financial investment. Cost is only in form of time and effort of the developer. Proxy servers are application gateways originally created as part of firewall systems to improve security. Internal systems connect to the outside world through the proxy server, and external systems respond to the proxy server. The external systems do not see a network of internal systems. They see only one system - the proxy server. Proxy server reduces the response time for any request from the client.


To develop a system according to the need of the end user and compatible to the most frequently used and easily available software and hardware, a detailed requirement specification is needed to be performed. The various requirement specifications are as follows:



A major requirement is to develop an application which reduces network and server load and provides increased client performance for most frequently used web pages by caching.

2) The application should act as a firewall between the LAN and the Internet. The firewall has to make sure that it denies the requests for any blocked site. 3) It should block those clients in LAN which are restricted for Internet access. 4) It should have a user friendly interface so that even a layman can use it and understand it with ease. 5) The software should be easily upgradeable in which new modules and features can easily be added. It needs to be specified that in case of a proxy server the user will be proxy server administrator.

The firewall of proxy has to block the HTTP request emanating from an invalid IP address. It also has to not to service the request for any link which is blocked by the proxy administrator. The proxy has to have cache to store the web pages locally to reduce latency and network load. A user friendly Graphical User Interface also needed to be supplied for proxy administrator.


Now what will follow is a series of modeling tasks that lead to a complete specification of requirement and a comprehensive design representation. We will follow the structured analysis model in which we create and partition data, functional and behavioral models.

Data modeling method make use of the entity relationship diagram. The entity relationship diagram is used to depict between data objects. The ERD defines all data that are entered, stored, transformed and produced with in an application. First of all by having a glance again at the requirement specification we pick up a list of things or objects (here it does not mean object of OOP) that the application is going to address. Following are the things that evolve into input/output objects: 1) User 2) Firewall 3) User Interface 4) Proxy Administrator 5) Cache Manager 6) Internet (abstract entity which generates HTTP response)



As information moves through software, it is modified by a series of transformations. Data Flow Diagrams is a graphical representation that depicts information flow and transformations that are applied as data moves from input to output. Here while depicting DFD we have assumed that the user views proxy and Internet as the system.



1 Level DFD:


2Level DFD:


1.) The requirement analysis shows that the logic flow is straight and linear. 2.) All the requirements are available beforehand. 3.) The project is stable. 4.) The requirements are fixed throughout the project.



The life cycle approach is derived from the waterfall model of system development described by ROYCE in 1970, is simplified version of which is given below: -


The stages of "The Waterfall Model" are:

Requirement Analysis & Definition: All possible requirements of the system to be developed are captured in this phase. Requirements are set of functionalities and constraints that the end-user (who will be using the system) expects from the system. The requirements are gathered from the end-user by consultation, these requirements are analyzed for their validity and the possibility of incorporating the requirements in the system to be development is also studied. Finally, a Requirement Specification document is created which serves the purpose of guideline for the next phase of the model. System & Software Design: Before a starting for actual coding, it is highly important to understand what we are going to create and what it should look like? The requirement specifications from first phase are studied in this phase and system design is prepared. System Design helps in specifying hardware and system requirements and also helps in defining overall system architecture. The system design specifications serve as input for the next phase of the model. Implementation & Unit Testing: On receiving system design documents, the work is divided in modules/units and actual coding is started. The system is first developed in small programs called units, which are integrated in the next phase. Each unit is developed and tested for its functionality; this is referred to as Unit Testing. Unit testing mainly verifies if the modules/units meet their specifications. Integration & System Testing: As specified above, the system is first divided in units which are developed and tested for their functionalities. These units are integrated into a complete system during Integration phase and tested to check if all modules/units coordinate between each other and the system as a whole behaves as per the specifications. After successfully testing the software, it is delivered to the customer.

Operations & Maintenance: This phase of "The Waterfall Model" is virtually never ending phase (Very long). Generally, problems with the system developed (which are not found during the development life cycle) come up after its practical use starts, so the issues related to the system are solved after deployment of the system. Not all the problems come in picture directly but they arise time to time and needs to be solved; hence this process is referred as Maintenance.


Although there are many variations on the theme of the life cycle, each approach has its own characteristics: Specific activities, techniques and outcomes are associated with each stage. Progression between stages is orderly and proceeds in a linear fashion . View to be a process by technicians Monitoring and control takes place at the end of each stage . Involvement of end users is typically passive and principally in the analysis stage.




At front end we have used Core java (J2SE1.6)

Introduction to Java:

Java (with a capital J) is a high-level, third generation programming language, like C, FORTRAN, Smalltalk, Perl, and many others. You can use Java to write computer applications that crunch numbers, process words, play games, store data or do any of the thousands of other things computer software can do. Compared to other programming languages, Java is most similar to C. However although Java shares much of C's syntax, it is not C. Knowing how to program in C or, better yet, C++, will certainly help you to learn Java more quickly, but you don't need to know C to learn Java. Unlike C++ Java is not a superset of C. A Java compiler won't compile C code, and most large C programs need to be changed substantially before they can become Java programs. What's most special about Java in relation to other programming languages is that it lets you write special programs called applets that can be downloaded from the Internet and played safely within a web browser


The Java Platform

A platform is the hardware or software environment in which a program runs. We've already mentioned some of the most popular platforms like Microsoft Windows, Linux, Solaris OS, and Mac OS. Most platforms can be described as a combination of the operating system and underlying hardware. The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other hardware-based platforms. The Java platform has two components:

The Java Virtual Machine The Java Application Programming Interface (API)

You've already been introduced to the Java Virtual Machine; it's the base for the Java platform and is ported onto various hardware-based platforms. The API is a large collection of ready-made software components that provide many useful capabilities. It is grouped into libraries of related classes and interfaces; these libraries are known as packages. The next section, What Can Java Technology Do? highlights some of the functionality provided by the API.

The API and Java Virtual Machine insulate the program from the underlying hardware. As a platform-independent environment, the Java platform can be a bit slower than native code. However, advances in compiler and virtual machine technologies are bringing performance close to that of native code without threatening portability.


In fact, its versatility, efficiency, platform portability, and security have made it the ideal technology for network computing, so that today, Java powers more than 4.5 billion devices:

over 800 million PCs over 1.5 billion mobile phones and other handheld devices (source: Ovum) 2.2 billion smart cards plus set-top boxes, printers, web cams, games, car navigation systems, lottery terminals, medical devices, parking payment stations, etc.

Today, you can find Java technology in networks and devices that range from the Internet and scientific supercomputers to laptops and cell phones, from Wall Street market simulators to home game players and credit cards -- just about everywhere. The best way to preview these applications is to explore, the ultimate marketplace, showcase, and central information resource for businesses, consumers, and software developers who use Java technology.


Features of Java:

1. Platform independent: The concept of Write-once-run-anywhere (known as the Platform independent) is one of the important key feature of java language that makes java as the most powerful language. Not even a single language is idle to this feature but java is closer to this feature. The programs written on one platform can run on any platform provided the platform must have the JVM. 2. Simple: There are various features that makes the java as a simple language. Programs are easy to write and debug because java does not use the pointers explicitly. It is much harder to write the java programs that can crash the system but we cannot say about the other programming languages. Java provides the bug free system due to the strong memory management. It also has the automatic memory allocation and deallocation system. 3. Object Oriented: To be an Object Oriented language, any language must follow at least the four characteristics.

Inheritance: It is the process of creating the new classes and using the behavior of the existing classes by extending them just to reuse the existing code and adding the additional features as needed. Encapsulation: It is the mechanism of combining the information and providing the abstraction. Polymorphism: As the name suggest one name multiple form, Polymorphism is the way of providing the different functionality by the functions having the same name based on the signatures of the methods. Dynamic binding: Sometimes we don't have the knowledge of objects about their specific types while writing our code. It is the

way of providing the maximum functionality to a program about the specific type at runtime. As the languages like Objective C, C++ fulfills the above four characteristics yet they are not fully object oriented languages because they are structured as well as object oriented languages. But in case of java, it is a fully Object Oriented language because object is at the outer most level of data structure in java. No stand alone methods, constants, and variables are there in java. Everything in java is object even the primitive data types can also be converted into object by using the wrapper class. 4. Robust: Java has the strong memory allocation and automatic garbage collection mechanism. It provides the powerful exception handling and type checking mechanism as compare to other programming languages. Compiler checks the program whether there any error and interpreter checks any run time error and makes the system secure from crash. All of the above features makes the java language robust. 5. Distributed: The widely used protocols like HTTP and FTP are developed in java. Internet programmers can call functions on these protocols and can get access the files from any remote machine on the internet rather than writing codes on their local system. 6. Portable: The feature Write-once-run-anywhere makes the java language portable provided that the system must have interpreter for the JVM. Java also has the standard data size irrespective of operating system or the processor. These features make the java as a portable language. 7. Dynamic: while executing the java program the user can get the required files dynamically from a local drive or from a computer thousands of miles away from the user just by connecting with the Internet. 8. Secure: Java does not use memory pointers explicitly. All the programs in java are run under an area known as the sand box. Security manager determines the accessibility options of a class like reading and writing a file to the local

disk. Java uses the public key encryption system to allow the java applications to transmit over the internet in the secure encrypted form. The byte code Verifier checks the classes after loading. 9. Performance: Java uses native code usage, and lightweight process called threads. In the beginning interpretation of byte code resulted the performance slow but the advance version of JVM uses the adaptive and just in time compilation technique that improves the performance. 10. Multithreaded: As we all know several features of Java like Secure, Robust, Portable, dynamic etc; you will be more delighted to know another feature of Java which is Multithreaded. Java is also a multithreaded programming language. Multithreading means a single program having different threads executing independently at the same time. Multiple threads execute instructions according to the program code in a process or a program. Multithreading works the similar way as multiple processes run on one computer. Multithreading programming is a very interesting concept in Java. In multithreaded programs not even a single thread disturbs the execution of other thread. Threads are obtained from the pool of available ready to run threads and they run on the system CPUs. This is how Multithreading works in Java which you will soon come to know in details in later chapters. 11. Interpreted: we all know that Java is an interpreted language as well. With an interpreted language such as Java, programs run directly from the source code. The interpreter program reads the source code and translates it on the fly into computations. Thus, Java as an interpreted language depends on an interpreter program. The versatility of being platform independent makes Java to outshine from other languages. The source code to be written and distributed is platform independent. Another advantage of Java as an interpreted language is its error debugging quality. Due to this any error occurring in the program gets traced. This is how it is different to work with Java.



We are using MySQL Database System. It documents MySQL up to Version 5.0.9-beta, but is also applicable for older versions of the MySQL software (such as 3.23 or 4.0-production) because functional changes are indicated with reference to a version number.

History of MySQL:
We started out with the intention of using mSQL to connect to our tables using our own fast low-level (ISAM) routines. However, after some testing, we came to the conclusion that mSQL was not fast enough or flexible enough for our needs. This resulted in a new SQL interface to our database but with almost the same API interface as mSQL. This API was designed to allow third-party code that was written for use with mSQL to be ported easily for use with MySQL. The derivation of the name MySQL is not clear. Our base directory and a large number of our libraries and tools have had the prefix my for well over 10 years. However, co-founder Monty Widenius's daughter is also named My. Which of the two gave its name to MySQL is still a mystery, even for us. The name of the MySQL Dolphin (our logo) is Sakila, which was chosen by the founders of MySQL AB from a huge list of names suggested by users in our Name the Dolphin contest. The winning name was submitted by Ambrose Twebaze, an Open Source software developer from Swaziland, Africa. According to Ambrose, the feminine name Sakila has its roots in SiSwati, the local language of Swaziland. Sakila is also the name of a town in Arusha, Tanzania, near Ambrose's country of origin, Uganda.


1.4.2. The Main Features of MySQL

The following list describes some of the important characteristics of the MySQL Database Software.

Internals and Portability o Written in C and C++. o Tested with a broad range of different compilers. o Works on many different platforms.. o Uses GNU Automake, Autoconf, and Libtool for portability. o APIs for C, C++, Eiffel, Java, Perl, PHP, Python, Ruby, and Tcl are available. o Fully multi-threaded using kernel threads. It can easily use multiple CPUs if they are available. o Provides transactional and non-transactional storage engines. o Uses very fast B-tree disk tables (MyISAM) with index compression. o Relatively easy to add another storage engine. This is useful if you want to add an SQL interface to an in-house database. o A very fast thread-based memory allocation system. o Very fast joins using an optimized one-sweep multi-join. o In-memory hash tables, which are used as temporary tables. o SQL functions are implemented using a highly optimized class library and should be as fast as possible. Usually there is no memory allocation at all after query initialization. o The MySQL code is tested with Purify (a commercial memory leakage detector) as well as with Valgrind, a GPL tool ( o The server is available as a separate program for use in a client/server networked environment. It is also available as a library that can be embedded (linked) into standalone applications. Such applications can be used in isolation or in environments where no network is available.

Column Types o Many column types: signed/unsigned integers 1, 2, 3, 4, and 8 bytes long, FLOAT, DOUBLE, CHAR, VARCHAR, TEXT, BLOB, DATE, TIME, DATETIME, TIMESTAMP, YEAR, SET, ENUM, and OpenGIS spatial types. o Fixed-length and variable-length records.

Statements and Functions o Full operator and function support in the SELECT and WHERE clauses of queries. For example: o mysql> SELECT CONCAT(first_name, ' ', last_name) o -> FROM citizen o -> WHERE income/dependents > 10000 AND age > 30; o Full support for SQL GROUP BY and ORDER BY clauses. Support for group functions (COUNT(), COUNT(DISTINCT ...), AVG(), STD(), SUM(), MAX(), MIN(), and GROUP_CONCAT()). o Support for LEFT OUTER JOIN and RIGHT OUTER JOIN with both standard SQL and ODBC syntax. o Support for aliases on tables and columns as required by standard SQL. o DELETE, INSERT, REPLACE, and UPDATE return the number of rows that were changed (affected). It is possible to return the number of rows matched instead by setting a flag when connecting to the server. o The MySQL-specific SHOW command can be used to retrieve information about databases, database engines, tables, and indexes. The EXPLAIN command can be used to determine how the optimizer resolves a query. o Function names do not clash with table or column names. For example, ABS is a valid column name. The only restriction is that for a function call, no spaces are allowed between the function name and the ( that follows it. ) o You can mix tables from different databases in the same query

Security o A privilege and password system that is very flexible and secure, and that allows host-based verification. Passwords are secure because all password traffic is encrypted when you connect to a server.


Scalability and Limits o Handles large databases. We use MySQL Server with databases that contain 50 million records. We also know of users who use MySQL Server with 60,000 tables and about 5,000,000,000 rows. o Up to 64 indexes per table are allowed (32 before MySQL 4.1.2). Each index may consist of 1 to 16 columns or parts of columns. The maximum index width is 1000 bytes (500 before MySQL 4.1.2). An index may use a prefix of a column for CHAR, VARCHAR, BLOB, or TEXT column types.

Connectivity o Clients can connect to the MySQL server using TCP/IP sockets on any platform. On Windows systems in the NT family (NT, 2000, XP, or 2003), clients can connect using named pipes. On Unix systems, clients can connect using Unix domain socket files. o In MySQL versions 4.1 and higher, Windows servers also support shared-memory connections if started with the -shared-memory option. Clients can connect through shared memory by using the --protocol=memory option. o The Connector/ODBC (MyODBC) interface provides MySQL support for client programs that use ODBC (Open Database Connectivity) connections. For example, you can use MS Access to connect to your MySQL server. Clients can be run on Windows or Unix. MyODBC source is available. All ODBC 2.5 functions are supported, as are many others. See o The Connector/J interface provides MySQL support for Java client programs that use JDBC connections. Clients can be run on Windows or Unix. Connector/J source is available.


Localization o The server can provide error messages to clients in many languages. o Full support for several different character sets, including latin1 (cp1252), german, big5, ujis, and more. For example, the Scandinavian characters , and are allowed in table and column names. Unicode support is available as of MySQL 4.1.

o o

All data is saved in the chosen character set. All comparisons for normal string columns are case-insensitive. Sorting is done according to the chosen character set (using Swedish collation by default). It is possible to change this when the MySQL server is started. To see an example of very advanced sorting, look at the Czech sorting code. MySQL Server supports many different character sets that can be specified at compile time and runtime.

Clients and Tools o The MySQL server has built-in support for SQL statements to check, optimize, and repair tables. These statements are available from the command line through the mysqlcheck client. MySQL also includes myisamchk, a very fast command-line utility for performing these operations on MyISAM tables. o All MySQL programs can be invoked with the --help or -? options to obtain online assistance.


Hardware Requirements
Processor RAM Monitor Keyboard Mouse : : : Pentium IV 2GHz or above 2GB RAM or above 15 Color Monitor

Software Requirements
Operating System : Windows XP

Front End Language used

: : Java (Edition : J2SE)

- Jdk - Compiler - Interpreter - Debugger - Developing Tool/IDE

: : : : :

Java Development kit 1.6 javac java jdb NetBeans IDE 6.5


BackEnd Database System

: : MySQL5.0.9-beta

Other Requirements:
Internet Connectivity.


Advantages of this proxy server are as follows:
1. Caching:

If it happens that the remote server/web server from where you are requesting any data has filtered out your IpAddress in that scenario you cannot access that particular data but if you had accessed that data before through a proxy then there are chances that the proxy server must have stored that data in it which is called cache, it can be accessed now if you connect through the proxy server. 2. Filtering Requests:

- A proxy server is a benefit for administration, because the network administrator can filter and a manage Internet usage from one machine. All users access the Internet from the proxy server, so network administrators can block certain pages and limit the amount of accessible websites. This type of filtering is usually done by large businesses that need to limit websites either individually or through categories. For instance, some proxy server software blocks whole categories such as entertainment, social networking or gaming sites. - Proxies are also used for bypassing blocked sites in schools, office and also access parental blocked data.


3. Improve Performance:

Proxy servers can dramatically improve performance for groups of users. This is because it saves the results of all requests for a certain amount of time. Consider the case where both user X and user Y access the World Wide Web through a proxy server. First user X requests a certain Web page, which we'll call Page 1. Sometime later, user Y requests the same page. Instead of forwarding the request to the Web server where Page 1 resides, which can be a time-consuming operation, the proxy server simply returns the Page 1 that it already fetched for user X. Since the proxy server is often on the same network as the user, this is a much faster operation. Real proxy servers support hundreds or thousands of users. The major online services such as America Online, MSN and Yahoo, for example, employ an array of proxy servers. Thus proxies can be used to speed up the browsing and access of data in a network because for caching as described above.

5. Spying: By this we can know which site is opened on a particular machine.




Scope of future improvement in this project is : Caching part can be further improved as speed becomes slower on opening of subsequent pages.

Complex images can be retrirved.

It can be improved to block selected users.

Request log part can be added to it.



A network is any collection of independent computers that communicate with one another over a shared network medium. A computer network is a collection of two or more connected computers. When these computers are joined in a network, people can share files and peripherals such as modems, printers, tape backup drives, or CD-ROM drives. When networks at multiple locations are connected using services available from phone companies, people can send e-mail, share links to the global Internet, or conduct video conferences in real time with other remote users. As companies rely on applications like electronic mail and database management for core business operations, computer networking becomes increasingly more important. But, as said a coin has two sides. Network has may disadvantages with security and speed being the primary concerns. Using a proxy server can reduce many problems. Now let us see what proxy server is.

A proxy server is a computer that offers a computer network service to allow clients to make indirect network connections to other network services. A client connects to the proxy server, then requests a connection, file, or other resource available on a different server. The proxy provides the resource either by connecting to the specified server or by serving it from a cache. In some cases, the proxy may alter the client's request or the server's response for various purposes.


HTTP Proxy Server: Middlemen" between clients and servers Proxies which process http and (not always) ftp requests are known as http proxy servers

Key features of HTTP Proxy servers: It Provides Anonymity and Security. It is a Caching Proxy server. Serves as content filter. Multithreading.

We designed and implemented a caching proxy server that handles HTTP traffic. It can be included into many programs: browsers, download managers etc. However, its support is not realized at a level of an operating system in order to use it, you should configure all programs, which should use proxies, in an appropriate way. It can carry out caching of information downloaded from the Internet. The application is implemented in Java, and as such it benefits from cross-platform portability.




JDesktopPane: A container used to create a multiple-document interface or a virtual desktop. You create JInternalFrame objects and add them to the JDesktopPane.

Virtual desktop: -Virtual desktop can be created using JDesktopPane and JInternalFrame. -JDesktopPane works as parent and JInternalFrame works as child.

JPanel: It acts as a cover to the container. Reusability highly increases if we use Panel as a base. CardLayout: - Multiple cards(JPanel) can be added to Card Layout. - Each card added to the Card Layout should be JPanel or its derived class - Only one card is visible at a time. -Navigation options like first,next,previous and last can be added. -CardLayout is used to create wizards.


JWindow: -It is very similar to JFrame but it does not have min ,max or close buttons. -It does not have borders,titlebar amn menubar. -It is used to create SplashScreen

JInternalFrame : A lightweight object that provides many of the features of a native frame, including dragging, closing, becoming an icon, resizing, title display, and support for a menu bar



Our project is designed to implement the basic functionalities of a proxy server. Though our product i.e. proxy server may not address all the functions, it simply provides a clear picture of how a proxy is working. This project stresses on caching. Caching has a lot of benefits. Caching is analogous to the mechanism used by a cache memory in memory hierarchy. When we talk of cache memory, it stores all the instructions which may be immediately needed by the processor. Hence, the processor first searches the instruction in the cache memory. It helps in improving the speed. Caching, in proxy server is similar to the above mechanism.


The project performs the following functions: a) It acts as an intermediary between a network and a client. This feature is very important for security purpose. It hides the clients IP address in the vast network. Hence, the system becomes secure. b) It performs the caching of websites. If the requested URL is stored in the cache, then the response is delivered via cache otherwise from the main server. c) It performs the basic URL blocking. But, it is not capable of performing this functionality selectively. It blocks the URL for all clients using the proxy.


SOFTWARE DEVELOPERS: The developers are expected to have a thorough knowledge of: a) b) c) d) The language in which the application is to be designed. Concepts of computer networking. Network programming in java. Data flow in the system

CLIENTS: Clients just need to be able to use the product


The functionalities which our project does not provide are: 1) 2) 3) 4) It does not provide efficient caching. It is not able to perform selective client blocking. It cannot track the Internet usage for each user. It does not provide specific packet filtering through ports


The functional requirements of this project include (1) GET, HEAD commands. The GET is the mostly used command in HTTP, carrying out the actual fetching of the content. Your program will need to parse a command line like, GET HTTP/1.1, from clients and then make a TCP connection to the target web server to get the requested page. The HEAD is similar to the GET except that only meta information, rather than a complete message-body (ex: the page), is returned. (2) Support of the If-Modified-Since conditional request. This header field in an HTTP request is typically used to examine whether the content stored in the proxy server is still valid. If not, the server fetches again the content from the origin site, forwards it to the client, and replaces the existing expired one.



1) This project performs the caching of web sites which improves the speed . 2) This project performs the basic URL blocking procedure. 3) It act as an intermediary between a network and a client.


EVOLUTION QUALITIES: This project has been designed with the help of Net Beans hence it is scalable and flexible. It can easily handle all future changes like addition of extra functionality. It is also easy to maintain, with all the source code and class file in one folder implicitly. this is in contrast to notepad programming, where we have to explicitly store all source code.



Our project uses virtual desktop concept in java. What is a virtual desktop? Virtual desktop can be created using JDesktopPane and JInternalFrame. JDesktopPane works as parent and JInternalFrame works as child. Steps to create Virtual Desktop: 1) Create JFrame. 2) Create JDesktopPane and add it to JFrame. 3) Create multiple instances of JIntaernalFrame and add it to JDesktopPane. 4) Each JInternalFrame can be covered by a separate JPanel.

The benefits of desktop virtualization include:

Cost savings because resources can be shared and allocated on an asneeded basis. More efficient use of resources and energy. Improved data integrity because backup is centralized. Centralized administration. Fewer compatibility issues.


GUI Listing: It opens a splash screen which displays the name of the project. A splash screen is an image that appears while a game or program is loading. It may also be used to describe an introduction page on a website. Splash screens sometimes do not cover the entire screen, but only a rectangle near the center. The splash screens of operating systems and some applications that expect to be run full-screen usually cover the entire screen. It opens a virtual desktop including a log-in page which allow only authenticated user to have access to the server. If user name and password is wrong, it shows an error message otherwise it opens a settings form. And it also includes settings for changing username and password It opens up a form which allows to change the username It opens up a form which allows to change the password

54 It consists of following elements: List: It displays the sites to be blocked Text Field: user can enter a site of his own choice to be blocked. Add Button: this adds the site given by the user to the list. Remove Button: user can select one or more sites in the list and clicking on this button removes the selected sites from the list. Continue Button: this is a confirmation button. After clicking this button, List, Add and Remove button gets disabled. After this user cannot enter any sites. Finish Button: Starts the (processing of software).








Our project comprises of five classes. They are: 1) 2) 3) 4) 5)


The project is run through this class. Server Socket, Socket and SERVER_PORT are initialized. Connection is established through serverSocket.accept(). It also starts the Talker thread.

This class listens to the multiple clients connecting to the server. It takes the input from the browsers address bar through BufferedReader and prints the request and various headers associated with the request. It also checks to see if the request contains the URL which we intend to block. If it contains the blocked URL, it calls the method siteBlocker() from the


SiteBlocker class otherwise it calls method getConnection() from the ProxyURLConnection class.

This class creates the constructor of URL class. It fetches the data associated with the URL given in the address bar. It calls the get() method from the URLCache class with parameters as url and browsers output stream.

This class contains the method siteBlocker() which gives the desired action to take if the clients request for a blocked site. This class defines a simple caching mechanism used by the proxy server. If it happens that the remote server/web server from where you are requesting any data has filtered out your IP Address in that scenario you cannot access that particular data but if you had accessed that data before through a proxy then there are chances that the proxy server must have stored that data in it which is called cache, it can be accessed now if you connect through the proxy server. Our project does not effectively implement caching. It uses a HashMap to store pairs of URL and content accessed by the clients. After every request made, this class first checks if the URL is present in the HashMap, if it is then it delivers the response from the cache. If not then, it delivers the response from the server.



package myproxy;

import; import; import java.util.Set;

public class MainClass {

public void startMain() { ServerSocket serverSocket = null; Socket socket = null; final int SERVER_PORT = 9867; try { serverSocket = new ServerSocket(SERVER_PORT); while (true) { socket = serverSocket.accept(); Talker tk = new Talker(socket); tk.start(); }


} catch (Exception e1) { e1.printStackTrace(); }

} }



package myproxy;


import; import; import;

public class Talker extends Thread {

BufferedReader input = null; PrintWriter output = null; String bSites;

public Talker() { }

public Talker(Socket socket, String str3) { try {


input = new BufferedReader(new InputStreamReader(socket.getInputStream())); output = new PrintWriter(socket.getOutputStream(), true); bSites = str3; } catch (Exception e1) { e1.printStackTrace(); } }

@Override public void run() { String file = new String(); ProxyURLClassConnection p = new ProxyURLClassConnection(); while (true) { try { String str = input.readLine(); if (str.indexOf("GET") != -1) { file = new String(); int x = str.indexOf(" "); int y = str.lastIndexOf(" "); file = str.substring(x + 1, y); } System.out.println(str); System.out.println("FILE : " + file);


int x1 = file.indexOf("."); int y1 = file.lastIndexOf("."); String site = file.substring(x1 + 1, y1);

if (bSites.indexOf(site) != -1) {


} else { p.getConnection(file, output);

} catch (Exception e2) { e2.printStackTrace(); System.out.println("Problem with Talker");

} output.close(); }

} }

package myproxy; import;

public class SiteBlocker {

public static void siteBlocker( PrintWriter output,String file) { { output.checkError(); output.write("Cannot Display........"); }


} }



package myproxy;

import*; import; import; import; import; import; import; import; public class ProxyURLClassConnection {

public void getConnection(String s,PrintWriter output) throws MalformedURLException, IOException { URL url = new URL(s);

URLConnection urlConnection = url.openConnection(); InputStream input = urlConnection.getInputStream();

URLCache u=new URLCache(); u.get(url,output);


output.close(); input.close(); }



import javax.swing.*; import java.awt.*;

public class Splash1 { public static void main(String[] args) { Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();

int x = (screen.width-400)/2; int y = (screen.height-300)/2;

JWindow win = new JWindow(); SplashPanel1 s = new SplashPanel1(); win.setContentPane(s); win.setBounds(x,y,400,300); win.setVisible(true);

try { for(int i=1;i<=100;i++){ Thread.sleep(60);;


} } catch(Exception e) {}

win.setVisible(false); VirtualDesktop m = new VirtualDesktop(); m.setBounds(0,0,screen.width,screen.height); m.setVisible(true); }



public class SplashPanel1 extends javax.swing.JPanel { public SplashPanel1() { initComponents(); }

public void abc(int a) { jProgressBar1.setValue(a); } private void initComponents() {

jProgressBar1 = new javax.swing.JProgressBar(); jLabel1 = new javax.swing.JLabel();

setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.bord er.BevelBorder.RAISED, null, new java.awt.Color(255, 153, 0), null, null)); setLayout(new java.awt.BorderLayout());

jProgressBar1.setBackground(new java.awt.Color(255, 153, 0)); jProgressBar1.setForeground(new java.awt.Color(255, 255, 255));


add(jProgressBar1, java.awt.BorderLayout.PAGE_END);

jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/myproxy.jpg"))); jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER ); add(jLabel1, java.awt.BorderLayout.CENTER); }

private javax.swing.JLabel jLabel1; private javax.swing.JProgressBar jProgressBar1;



Output is retrieved by following steps:

1. Run Splash1, which causes SplashPanel1 to run. 2. We enter the login id and password. 3. It directs us to another page which asks for the sites to be blocked. 4. We click on next. It takes to confirmation page where we click on finish which starts proxy server.


One of the limitations is that you may have some issues with speed. Caching becomes a bit slower in case of opening of subsequent pages. It is not being able to retrieve complex images.


This project is designed to act as a http proxy server. It includes the following:

A robust caching mechanism, that is optimized to minimize the time that end users wait for documents to load by giving preference to documents that must be loaded over the slowest Internet links, that are from servers that take long time to connect to, that have been referenced more frequently, and that are small. Multithreading, to allow concurrent handling of several HTTP requests. Great care has been given to concurrency control, to ensure mutual exclusion between threads where needed and to avoid deadlocks. Customization of the proxy is done via the graphical interface. This project include feature of filtering of sites.



Proxy Settings in Internet Explorer 5.X 8.x :

1. Open Internet Explorer. 2. In Menu Bar go to ToolInternet Options. 3. In Internet Options Window - go to Connections Menu within LAN Settings - click on LAN Settings button. 4. In LAN Settings Window - Within Proxy Server checkmark the checkbox in front of Use a Proxy Server for your LAN -Specify your Systems IPAddress, it will behave as proxy server -Specify port number as 9867 -Click on OK

Starting Proxy Server Software:

1. Run the Proxy.jar which starts Proxy server software 2. For login page default username and password is aks .


Complete reference java(J2SE) Herbert Schildt Thinking in java- Bruce Eckel computer networking by Behrouz Forouzan Proxy Server by Kurt Hudson www.wikipedia .com