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

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

?? wapclient.java~1~

?? jwap 協議 udp 可以用于手機通訊
?? JAVA~1~
?? 第 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一区二区三区免费野_久草精品视频
精品无码三级在线观看视频| 国产高清久久久久| 久久久91精品国产一区二区精品| 亚洲中国最大av网站| 97aⅴ精品视频一二三区| 欧美日韩在线观看一区二区| 国产一区在线观看麻豆| 亚洲色图在线视频| 日韩欧美www| 5858s免费视频成人| 在线一区二区三区四区| 色综合久久99| 99久久精品久久久久久清纯| 五月激情丁香一区二区三区| 国产精品美女视频| 69p69国产精品| 欧美一区永久视频免费观看| 成人黄色a**站在线观看| 国产在线国偷精品产拍免费yy| 理论片日本一区| 国内外成人在线视频| 韩国毛片一区二区三区| 色婷婷综合久久久中文一区二区 | 91视频一区二区三区| 欧美日韩激情一区| 日韩精品一区国产麻豆| 欧美大片顶级少妇| 欧美精品一区二区三| 国产欧美在线观看一区| 国产精品污www在线观看| 亚洲日本一区二区三区| 亚洲国产成人av网| 免费在线视频一区| 成人黄色片在线观看| 欧美色综合天天久久综合精品| 91精品国产综合久久香蕉的特点| 日韩一区二区三区免费观看| 久久在线免费观看| 性久久久久久久久| 国产精品一二三区在线| 欧美在线观看一区| 久久九九久久九九| 亚洲超碰精品一区二区| 国产成人精品一区二区三区网站观看| 欧美亚洲国产怡红院影院| 欧美久久久久久久久| 国产精品入口麻豆原神| 亚洲综合成人网| 国产精品一品二品| 欧美综合在线视频| 国产精品免费看片| 日本午夜一本久久久综合| 99久久夜色精品国产网站| 久久综合色一综合色88| 午夜精品久久久久久久蜜桃app| 韩国v欧美v亚洲v日本v| 在线91免费看| 日日夜夜精品视频免费| 日本高清成人免费播放| 综合中文字幕亚洲| 大美女一区二区三区| 久久一二三国产| 国产一区二区三区久久悠悠色av| 欧美精品在线一区二区| 午夜精品久久久久久久99樱桃| 欧美久久一二三四区| 日韩欧美国产高清| 亚洲国产日韩一级| 国产成人精品免费在线| www.亚洲激情.com| 久久―日本道色综合久久| 五月婷婷另类国产| 欧美成人精品3d动漫h| 欧美在线制服丝袜| 在线观看一区不卡| 在线看不卡av| 中文字幕一区二区三区视频 | 日本欧美在线观看| 91在线国产福利| 久久精品一区蜜桃臀影院| 麻豆91免费观看| 91精品午夜视频| 亚洲国产日韩一级| 91久久精品一区二区三区| 国产精品系列在线| 国产伦精品一区二区三区视频青涩 | 亚洲三级免费电影| 成人一级片网址| 国产亚洲一区二区三区四区| 久久成人麻豆午夜电影| 欧美一区二区三区四区视频| 亚洲成人tv网| 欧美日韩国产另类一区| 亚洲一区二区视频| 精品va天堂亚洲国产| 日本va欧美va精品| 欧美一区二区三区不卡| 日韩国产精品91| 欧美精品久久一区二区三区| 亚洲国产精品一区二区www | 中文字幕永久在线不卡| 懂色av一区二区夜夜嗨| 欧美经典一区二区| 国产成人午夜99999| 国产农村妇女毛片精品久久麻豆 | 精品国产乱码久久久久久老虎| 天天av天天翘天天综合网| 欧美日韩一级片在线观看| 亚洲国产欧美在线人成| 欧美电影在哪看比较好| 男女激情视频一区| 欧美精品一区视频| 国产激情视频一区二区三区欧美 | 狠狠色2019综合网| 久久久蜜桃精品| 99久久伊人网影院| 亚洲精品久久7777| 欧美日韩视频一区二区| 日韩电影在线免费观看| 日韩欧美精品在线| 国产成人精品午夜视频免费| 国产精品―色哟哟| 欧洲在线/亚洲| 秋霞电影网一区二区| 久久久久久久综合狠狠综合| 成a人片国产精品| 一区二区三区日韩精品| 欧美日韩免费电影| 韩国三级在线一区| 国产精品女上位| 欧美三级视频在线| 久久超碰97人人做人人爱| 日本一区二区三区高清不卡| 99精品久久99久久久久| 午夜精品久久久久久久99水蜜桃| 欧美变态tickle挠乳网站| 丁香亚洲综合激情啪啪综合| 亚洲激情图片qvod| 日韩欧美高清一区| 菠萝蜜视频在线观看一区| 性做久久久久久久免费看| 久久先锋资源网| 日本韩国欧美一区二区三区| 视频一区在线播放| 国产精品天天看| 欧美日韩精品三区| 国产成人精品亚洲日本在线桃色 | 国产在线不卡一区| 自拍视频在线观看一区二区| 在线不卡a资源高清| 成人午夜电影网站| 日韩国产高清在线| 亚洲色图在线看| 久久这里只有精品首页| 欧美在线看片a免费观看| 国产成人综合网站| 天天操天天色综合| 中文字幕字幕中文在线中不卡视频| 国产精品青草久久| 日韩一级大片在线观看| av午夜精品一区二区三区| 另类人妖一区二区av| 一区二区在线观看免费| 2021久久国产精品不只是精品| 欧美中文字幕一二三区视频| 国产不卡在线一区| 喷白浆一区二区| 一区二区三区精品视频| 国产日韩成人精品| 日韩精品一区二区三区四区视频| 蜜桃一区二区三区在线| 国产精品影视天天线| av在线播放不卡| 亚洲精品在线网站| 亚洲美女视频在线观看| 黄网站免费久久| 欧美日韩精品欧美日韩精品一综合| 日韩视频永久免费| 亚洲最新视频在线观看| 高清国产一区二区| 久久综合中文字幕| 日韩电影在线免费看| 日本久久精品电影| 欧美国产国产综合| 国产乱人伦偷精品视频免下载| 91片在线免费观看| 亚洲欧美怡红院| 粉嫩av一区二区三区| 久久久久久日产精品| 久久99精品国产.久久久久久 | 亚洲一区在线观看网站| 成人一级视频在线观看| 久久久高清一区二区三区| 国产69精品一区二区亚洲孕妇| 亚洲一区二区三区四区五区黄| 在线观看一区日韩| 中文字幕色av一区二区三区| 成人av资源在线观看| 男女男精品网站| 亚洲国产成人91porn|