@@ -109,53 +109,54 @@ private void handleSession(final Connection CONNECTION, final CurrentConnections
109109 try (java .net .Socket proxy = new java .net .Socket ())
110110 {
111111 proxy .connect (new java .net .InetSocketAddress (WebExpress .REMOTE_SITE , Integer .parseInt (WebExpress .REMOTE_PORT )), PROXY_READ_TIMEOUT_MS );
112+
112113 proxy .setSoTimeout (PROXY_READ_TIMEOUT_MS );
113114
114115 java .io .OutputStream proxyOut = proxy .getOutputStream ();
116+
115117 String httpRequest = "GET / HTTP/1.0\r \n Host: " + WebExpress .REMOTE_SITE + "\r \n Connection: close\r \n \r \n " ;
118+
116119 proxyOut .write (httpRequest .getBytes ());
120+
117121 proxyOut .flush ();
118122
119- CommonRails .printSystemComponent (this , this .hashCode (),
120- "WebExpress SessionHandler >> forwarded HTTP GET to " + WebExpress .REMOTE_SITE + ":" + WebExpress .REMOTE_PORT + "." );
123+ CommonRails .printSystemComponent (this , this .hashCode (), "WebExpress SessionHandler >> forwarded HTTP GET to " + WebExpress .REMOTE_SITE + ":" + WebExpress .REMOTE_PORT + "." );
121124
122125 java .io .OutputStream clientOut = CONNECTION .SOCKET .getOutputStream ();
126+
123127 byte [] chunk = new byte [4096 ];
124128 int read ;
129+
125130 long deadline = System .currentTimeMillis () + PROXY_WALL_TIMEOUT_MS ;
126131
127132 while (System .currentTimeMillis () < deadline && (read = proxy .getInputStream ().read (chunk )) != -1 )
128133 {
129134 clientOut .write (chunk , 0 , read );
135+
130136 clientOut .flush ();
131137
132- CommonRails .printSystemComponent (this , this .hashCode (),
133- "WebExpress SessionHandler >> proxied [" + read + " bytes] to client." );
138+ CommonRails .printSystemComponent (this , this .hashCode (),"WebExpress SessionHandler >> proxied [" + read + " bytes] to client." );
134139 }
135140 }
136141
137142 // Enqueue for MessageQueueSorter audit trail
138- MessageQueue .Message MSG = new MessageQueue .Message ();
139- MSG .CONNECTION = CONNECTION ;
140- MSG .SOCKET = CONNECTION .SOCKET ;
141- MSG .INTERNET_ADDRESS = CONNECTION .SOCKET .getInetAddress ();
142- MSG .TIME_STAMP = new Date ();
143- MSG .MESSAGE_BUFFER = new StringBuffer (BUFFER );
144-
145- this .WEBEXPRESS .MESSAGE_QUEUE .add (MSG );
143+ MessageQueue .Message MESSAGE = new MessageQueue .Message ();
144+ MESSAGE .CONNECTION = CONNECTION ;
145+ MESSAGE .SOCKET = CONNECTION .SOCKET ;
146+ MESSAGE .INTERNET_ADDRESS = CONNECTION .SOCKET .getInetAddress ();
147+ MESSAGE .TIME_STAMP = new Date ();
148+ MESSAGE .MESSAGE_BUFFER = new StringBuffer (BUFFER );
149+
150+ this .WEBEXPRESS .MESSAGE_QUEUE .add (MESSAGE );
146151 }
147152 catch (Exception e )
148153 {
149154 ExceptionHandler .dispatch (e );
150155
151- CommonRails .printSystemComponent (this , this .hashCode (),
152- "WebExpress SessionHandler >> exception [" + e .getMessage () + "]." );
156+ CommonRails .printSystemComponent (this , this .hashCode (), "WebExpress SessionHandler >> exception [" + e .getMessage () + "]." );
153157 }
154- // Do NOT remove from CONNECTIONS here — BaseServer.run() cleans up on socket close
155158 }
156159
157- // ── Poller loop: accepts new connections, marks them, spawns handler ──────
158-
159160 @ Override
160161 public void run ()
161162 {
@@ -208,7 +209,6 @@ public void run()
208209 H .start ();
209210 }
210211
211- // Clean up closed sockets
212212 if (SocketUtils .isConnected (CONNECTION .SOCKET ))
213213 {
214214 CONNECTIONS .remove (CONNECTION );
0 commit comments