Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

38
LINES

< > BotCompany Repo | #1032718 // StandaloneHttpProxy Test for webssh

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 1113K of libraries. Click here for Pure Java version (8483L/42K).

!7

cm ProxyTest > DynPrintLogAndEnabled {
  transient autoDispose new L<StandaloneHttpProxy> proxies;
  
  switchable int httpInPort = 8080;
  switchable int httpsInPort;
  switchable int httpOutPort = 8888;
  
  *() { enabled = false; }

  void startProxy(StandaloneHttpProxy proxy) ctex {  
    proxy.forwardServerAndPort = req -> HostAndPort("localhost", httpOutPort);
    proxy.serveLocalhostOnly = true;
    proxy.rewriteHostHeader = false;
    proxies.add(proxy);
    proxy.start();
  }

  start {
    if (!enabled) ret;
    
    if (httpInPort != 0) {
      new StandaloneHttpProxy proxy;
      proxy.port = httpInPort;
      startProxy(proxy);
    }
    
    if (httpsInPort != 0) {
      new StandaloneHttpProxy proxy;
      var serverSocketFactory = serverSocketFactory_botCompanyEtc();
      proxy.port = httpsInPort;
      proxy.makeServerSocket = -> ctex { ret serverSocketFactory.createServerSocket(proxy.port); };
      startProxy(proxy);
    }
    
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, iveijnkanddl, mqqgnosmbjvj

No comments. add comment

-
Snippet ID: #1032718
Snippet name: StandaloneHttpProxy Test for webssh
Eternal ID of this version: #1032718/7
Text MD5: 08a2c33e862eddf5ce4404b2f00e8ff3
Transpilation MD5: 3aaeed5cc4116a8d173cb4b9bedcf508
Author: stefan
Category: javax / http
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-03 22:06:51
Source code size: 1008 bytes / 38 lines
Pitched / IR pitched: No / No
Views / Downloads: 143 / 325
Version history: 6 change(s)
Referenced in: