亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? wapclient.java~2~

?? jwap 協議 udp 可以用于手機通訊
?? JAVA~2~
?? 第 1 頁 / 共 2 頁
字號:
/** * JWAP - A Java Implementation of the WAP Protocols * Copyright (C) 2001-2004 Niko Bender * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */package net.sourceforge.jwap;import java.io.ByteArrayOutputStream;import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.net.InetAddress;import java.net.SocketException;import java.net.UnknownHostException;import java.util.Enumeration;import java.util.Hashtable;import java.util.*;import java.util.Calendar;import java.lang.String;import net.sourceforge.jwap.util.Logger;import net.sourceforge.jwap.wsp.CWSPMethodManager;import net.sourceforge.jwap.wsp.CWSPResult;import net.sourceforge.jwap.wsp.CWSPSession;import net.sourceforge.jwap.wsp.CWSPSocketAddress;import net.sourceforge.jwap.wsp.IWSPUpperLayer2;import net.sourceforge.jwap.wsp.pdu.CWSPHeaders;import net.sourceforge.jwap.wtp.CWTPSocket;import net.sourceforge.jwap.util.wbxml.WBXMLDecoder;import org.w3c.dom.Document;import org.apache.xml.serialize.XMLSerializer;import org.apache.xml.serialize.OutputFormat;/** * This class represents a WSP "User-Agent" which can be used for executing * WSP <code>GET</code> and <code>POST</code> methods. * <p> * <h3>Example</h3> * <pre> * WAPClient client = new WAPClient("localhost", 9201); * Request request = new GetRequest("http://localhost/"); * client.connect(); * Response response = client.execute(request); * client.disconnect(); * </pre> * @author Michel Marti * */public class WAPClient {  /** Default connect/disconnect timeout in milliseconds: 30000 */  public static final long DEFAULT_CONNECT_TIMEOUT = 30000;  /** Default execute timeout in milliseconds: 180000 */  public static final long DEFAULT_EXEC_TIMEOUT = 180000;  private static final Logger log = Logger.getLogger(WAPClient.class);  static {    Logger.initLogSystem(true);  }  private static final String USAGE =      "Usage: WAPClient <WAP-Gateway-address[:port]> [GET/POST] [options] <URL>\n" +      "   if method (GET/POST) is unspecified, GET is assumed\n\n" +      "   Common options:\n" +      "      -u <user-agent>   The User-Agent (defaults to jWAP/1.x)\n" +      "      -o <file>         write response to file\n" +      "      -l [addr]:port    local port (and address) to bind to\n" +      "      -tc <timeout>     connection timeout (seconds, default=30)\n" +      "      -tx <timeout>     request timeout (seconds, default=180)\n" +      "      -v                show response-headers\n\n" +      "   POST options:\n" +      "      -c <content-type> The content-type  of the response body\n" +      "      -p <file>         A file containing the post data, use '-' to read" +      " the post data from standard input";  private static final String DEFAULT_CONTENT_TYPE = "application/unknown";  private static final String CONNECTED = "CONNECTED";  private InetAddress gwAddr;  private InetAddress localAddr;  private int gwPort;  private int localPort;  private CWSPSession session;  private long disconnectTimeout;  private byte[] sessionLock = new byte[0];  private IWSPUpperLayer2 upperLayerImpl;  private Hashtable pendingRequests;  private WAPClient() {}  /**   * Construct a new WAP Client   * @param wapGateway hostname of the WAP gateway to use   * @param port port-number   * @throws UnknownHostException if the hostname cannot be resolved   */  public WAPClient(String wapGateway, int port) throws UnknownHostException {    this(InetAddress.getByName(wapGateway), port);  }  /**   * Construct a new WAP Client   * @param wapGateway the address of the WAP gateway to use   * @param port the WAP gateway port number   */  public WAPClient(InetAddress wapGateway, int port) {    this(wapGateway, port, null, CWTPSocket.DEFAULT_PORT);  }  /**   * Construct a new WAP Client   * @param wapGateway the addresss of the WAP gateway to use   * @param wapPort the WAP gateway port number   * @param localAddress the local address to bind to   * @param localPort the local port to bind to (0 to let the OS pick a free port)   */  public WAPClient(InetAddress wapGateway, int wapPort,                   InetAddress localAddress,                   int localPort) {    gwAddr = wapGateway;    gwPort = wapPort;    this.localAddr = localAddress;    this.localPort = localPort;    upperLayerImpl = new UpperLayerImpl();    pendingRequests = new Hashtable();  }  /**   * Execute a request. The client must be connected to the gateway.   * @param request the request to execute   * @return the response   * @throws SocketException if a timeout occurred   * @throws IllegalStateException if the client is not connected   */  public Response execute(Request request) throws SocketException,      IllegalStateException {    return execute(request, DEFAULT_EXEC_TIMEOUT);  }  /**   * Execute a request. The client must be connected to the gateway.   * @param request the request to execute   * @param timeout timeout in milliseconds   * @return the response   * @throws SocketException if a timeout occurred   * @throws IllegalStateException if the client is not connected   */  public Response execute(Request request, long timeout) throws SocketException,      IllegalStateException {    CWSPMethodManager mgr = null;    synchronized (this) {      if (session == null) {        throw new IllegalStateException("Not yet connected");      }      CWSPHeaders headers = request.getWSPHeaders();      if (headers.getHeader("accept") == null) {        headers.setHeader("accept", "*/*");      }      String uh = headers.getHeader("user-agent");      if (uh == null) {        headers.setHeader("user-agent", "jWAP/1.2");      }      else if ("".equals(uh)) {        headers.setHeader("user-agent", null);      }      if (request instanceof GetRequest) {        if (log.isDebugEnabled()) {          log.debug("Executing GET Request for URL " + request.getURL());        }        mgr = session.s_get(headers, request.getURL());      }      else if (request instanceof PostRequest) {        if (log.isDebugEnabled()) {          log.debug("Executing POST Request for URL " + request.getURL());        }        PostRequest post = (PostRequest) request;        mgr = session.s_post(post.getWSPHeaders(), post.getRequestBody(),                             post.getContentType(), post.getURL());      }    }    // Wait until the method shows up in our hashtable    if (log.isDebugEnabled()) {      log.debug("Waiting " + timeout + "ms for execute completion...");    }    Response response = (Response) waitForCompletion(mgr, timeout);    if (response == null) {      throw new SocketException("Timeout executing request");    }    return response;  }  /**   * Connect to the WAP gateway. Before requests can be executed, this method   * must be called.   * @throws SocketException if the connection could not be established   * @throws IllegalStateException if the client is already connected   */  public synchronized void connect() throws SocketException,      IllegalStateException {    connect(DEFAULT_CONNECT_TIMEOUT);  }  /**   * Connect to the WAP gateway. Before requests can be executed, this method   * must be called.   * @param timeout timeout in milliseconds   * @throws SocketException if the connection could not be established   * @throws IllegalStateException if the client is already connected   */  public synchronized void connect(long timeout) throws SocketException,      IllegalStateException {    connect(null, timeout);  }  /**   * Connect to the WAP gateway. Before requests can be executed, this method   * must be called.   * @param timeout timeout in milliseconds   * @param headers WSP headers used for connect or null   *   objects. The headers will be encoded using the default WAP codepage.   * @throws SocketException if the connection could not be established   * @throws IllegalStateException if the client is already connected   */  public synchronized void connect(CWSPHeaders headers, long timeout) throws      SocketException, IllegalStateException {    if (session != null) {      throw new IllegalStateException("Already connected");    }    disconnectTimeout = timeout;    pendingRequests.clear();    if (log.isDebugEnabled()) {      log.debug("Establishing WSP session with " + gwAddr.getHostAddress() +                ":" + gwPort);    }    session = new CWSPSession(gwAddr, gwPort, localAddr, localPort,                              upperLayerImpl, false);    session.s_connect(headers);    Object result = waitForCompletion(sessionLock, timeout);    if (result == null) {      CWSPSession ts = session;      session = null;      try {        ts.s_disconnect();      }      catch (Exception unknown) {}      throw new SocketException("connect: Timeout occurred");    }    if (result != null) {      if (result instanceof CWSPSocketAddress[]) {        // redirect received ...        CWSPSocketAddress[] addr = (CWSPSocketAddress[]) result;        if (addr.length > 0) {          // Take the first address and try to reconnect...          gwAddr = addr[0].getAddress();          int p = addr[0].getPort();          if (p > 0) {            gwPort = p;          }          session = null;          if (log.isDebugEnabled()) {            log.debug("Redirect to " + gwAddr.getHostAddress() + ":" + gwPort);          }          connect(headers, timeout);          return;        }      }      else if (!CONNECTED.equals(result)) {        CWSPSession ts = session;        session = null;        ts.s_disconnect();        if (result == null) {          throw new SocketException("Timeout while establishing connection");        }        else if (!CONNECTED.equals(result)) {          throw new SocketException("Connection failed.");        }      }    }    log.debug("Connection established");  }  /**   * Disconnect from the WAP gateway. This releases used resources as well.   */  public synchronized void disconnect() {    if (session == null) {      return;    }    log.debug("Disconnecting client...");    CWSPSession ts = session;    session = null;    ts.s_disconnect();    // Wait for confirmation    Object result = waitForCompletion(sessionLock, disconnectTimeout);    session = null;    log.debug("Client disconnected...");  }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
老鸭窝一区二区久久精品| 久久成人久久鬼色| 最新高清无码专区| 国产成人免费xxxxxxxx| 美女在线视频一区| av网站一区二区三区| 色综合久久99| 久久久久久麻豆| 亚洲主播在线播放| 看电影不卡的网站| 成人av网站在线观看| 日韩欧美一区二区免费| 日韩理论电影院| 国产一区不卡精品| 色av一区二区| 中文字幕在线不卡视频| 免费高清成人在线| 欧美亚洲综合久久| 日韩一区中文字幕| 美女视频一区二区三区| 欧美午夜寂寞影院| 一区二区三区在线观看视频| 国产在线播放一区三区四| 欧美系列一区二区| 成人在线视频首页| 欧美三级欧美一级| 欧美成人官网二区| 国产精品色婷婷久久58| 最新成人av在线| 人人精品人人爱| 91精品国产91热久久久做人人 | 99国产精品久久久久久久久久 | 国产91对白在线观看九色| 欧美电影精品一区二区| 激情另类小说区图片区视频区| 欧美另类高清zo欧美| 卡一卡二国产精品| 久久亚洲一级片| youjizz国产精品| 亚洲在线视频网站| 精品国产伦一区二区三区观看方式| 精品系列免费在线观看| 亚洲欧洲性图库| 91精品在线免费| 成人爱爱电影网址| 日本成人中文字幕| 国产精品免费观看视频| 欧美高清精品3d| 99久久99久久精品免费看蜜桃| 亚洲美女免费视频| 日韩欧美自拍偷拍| 国产一区二区毛片| 亚洲免费在线播放| 国产亚洲欧洲997久久综合 | 午夜精品爽啪视频| 久久久久97国产精华液好用吗| 国产成人午夜精品5599| 日韩成人精品在线观看| 亚洲色图欧美在线| 亚洲婷婷综合色高清在线| 久久综合九色综合久久久精品综合| 一本色道**综合亚洲精品蜜桃冫| 精品一区二区三区不卡 | 欧洲亚洲国产日韩| 国产精品一区二区久久不卡| 首页亚洲欧美制服丝腿| 一区二区三区四区在线| 亚洲精品成人悠悠色影视| 国产欧美日韩视频在线观看| 2020国产精品自拍| 中文字幕av免费专区久久| 久久免费偷拍视频| 日本一区二区三区免费乱视频 | 青青草伊人久久| 精品一区二区在线看| 美女视频黄频大全不卡视频在线播放| 亚洲另类色综合网站| 日韩av电影一区| 国精品**一区二区三区在线蜜桃| 奇米影视7777精品一区二区| 韩国精品免费视频| 不卡电影免费在线播放一区| 99精品视频在线播放观看| 欧美日韩日日摸| 久久久久国产一区二区三区四区 | 精品免费视频.| 亚洲欧洲精品一区二区三区 | 亚洲一区二区三区在线看| 久久精品国产亚洲a| 99re这里都是精品| 欧美大片在线观看一区| 亚洲免费视频成人| 成人综合在线视频| 欧美成人vps| 亚洲aaa精品| 91视频一区二区| 中文天堂在线一区| 国产尤物一区二区在线| 91精品综合久久久久久| 亚洲精品一二三| 色美美综合视频| 亚洲免费观看视频| 在线看国产一区二区| 亚洲欧美在线aaa| 91视频在线观看| 国产精品久久毛片a| 成人av网址在线| 亚洲精品ww久久久久久p站| av中文一区二区三区| 中文字幕欧美一| 色噜噜狠狠色综合中国| 亚洲一区二区三区四区五区黄| 欧美性色综合网| 日韩二区三区在线观看| 精品国产乱子伦一区| 国产美女av一区二区三区| 国产精品美女一区二区三区| 成人精品小蝌蚪| 亚洲一二三四区不卡| 5858s免费视频成人| 国产成人免费在线视频| 一区二区国产视频| 欧美va日韩va| 日本黄色一区二区| 国产91丝袜在线观看| 欧洲日韩一区二区三区| 国产精品午夜在线观看| 成人午夜av在线| 亚洲精品国产无天堂网2021| 国内精品伊人久久久久av影院| 欧美人体做爰大胆视频| 成人av网址在线观看| 国内精品视频一区二区三区八戒 | 久久福利视频一区二区| 亚洲三级免费观看| 国产欧美日本一区二区三区| 欧美日韩在线播放三区四区| 成人精品小蝌蚪| 国产大片一区二区| 国产在线精品一区二区夜色 | 国产一区美女在线| 一区二区三区中文在线观看| 中文字幕成人av| 久久久久青草大香线综合精品| 51精品秘密在线观看| 欧美视频一区在线| 7777女厕盗摄久久久| 欧美人动与zoxxxx乱| 日韩写真欧美这视频| 91麻豆精品国产91久久久久久久久 | 亚洲天堂av一区| 成人免费一区二区三区视频| 亚洲视频一区在线| 亚洲二区视频在线| 热久久久久久久| 成人av在线资源网| 一本到一区二区三区| 在线不卡中文字幕| 精品对白一区国产伦| 国产精品久久免费看| 日韩毛片精品高清免费| 免费的国产精品| 99国产精品久久久| 717成人午夜免费福利电影| 久久久99精品免费观看| 一区二区三区精密机械公司| 麻豆精品蜜桃视频网站| 91蜜桃免费观看视频| 欧美精品一区二区久久婷婷| 一级中文字幕一区二区| 国产传媒欧美日韩成人| 欧美日韩一区二区在线观看| 欧美国产一区视频在线观看| 亚洲国产精品影院| 99re66热这里只有精品3直播| 欧美刺激午夜性久久久久久久| 亚洲少妇屁股交4| 99久久综合国产精品| 日韩免费电影一区| 香蕉乱码成人久久天堂爱免费| 99国产欧美另类久久久精品| 久久综合精品国产一区二区三区| 亚洲香肠在线观看| 色天天综合久久久久综合片| 一区视频在线播放| 色综合天天综合网天天看片| 中文成人综合网| 91在线国产观看| 国产免费成人在线视频| 成人高清视频免费观看| 国产精品超碰97尤物18| 97久久精品人人做人人爽| 亚洲黄色片在线观看| 欧美色精品在线视频| 老司机精品视频导航| 亚洲国产精华液网站w| 在线观看一区日韩| 老汉av免费一区二区三区| xf在线a精品一区二区视频网站| 国产精品99久久久久久有的能看|