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

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

?? wapclient.java~3~

?? jwap 協議 udp 可以用于手機通訊
?? JAVA~3~
?? 第 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一区二区三区免费野_久草精品视频
欧美午夜精品一区二区蜜桃| 亚洲激情一二三区| 开心九九激情九九欧美日韩精美视频电影 | 日韩电影在线一区二区三区| 欧美最新大片在线看| 日韩中文欧美在线| 日韩精品一区二区三区swag| 国产制服丝袜一区| 欧美激情一区二区三区全黄| 99精品桃花视频在线观看| 国产精品黄色在线观看| 91国在线观看| 日本不卡在线视频| 26uuu欧美| 99国产精品视频免费观看| 亚洲自拍偷拍网站| 日韩欧美高清dvd碟片| 国产一区二区三区在线观看免费视频| 国产三级欧美三级| 在线中文字幕不卡| 黄一区二区三区| 亚洲日本va午夜在线电影| 欧美美女黄视频| 国产传媒日韩欧美成人| 亚洲综合男人的天堂| 欧美一级二级三级乱码| 不卡av在线网| 日本中文一区二区三区| 国产精品视频一二| 这里只有精品免费| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 91免费观看视频| 日本不卡视频在线观看| 国产精品伦理一区二区| 日韩欧美一区二区久久婷婷| 不卡一区二区中文字幕| 热久久一区二区| 亚洲另类中文字| 久久综合九色欧美综合狠狠| 91免费国产视频网站| 国精品**一区二区三区在线蜜桃| 亚洲精品日韩专区silk| 国产亚洲欧美一区在线观看| 欧美精品在线一区二区| 99天天综合性| 国产一区二区三区视频在线播放| 一区二区在线免费观看| 国产女人18毛片水真多成人如厕| 538prom精品视频线放| 91在线观看地址| 国产激情偷乱视频一区二区三区| 日韩一区精品视频| 亚洲欧美区自拍先锋| 亚洲国产成人在线| 26uuu色噜噜精品一区| 91精品国产91久久综合桃花| 91蝌蚪国产九色| 成人免费视频一区| 国产一区二区伦理| 麻豆国产精品一区二区三区| 亚洲电影中文字幕在线观看| 亚洲欧美成人一区二区三区| 国产人伦精品一区二区| 欧美成人三级在线| 51精品秘密在线观看| 欧美日韩中文字幕精品| 色先锋久久av资源部| youjizz国产精品| 成人一区二区视频| 粉嫩嫩av羞羞动漫久久久 | 天天综合色天天综合| 亚洲精品日韩综合观看成人91| 中文字幕在线观看不卡| 国产精品久久久久久久午夜片| 久久久久久久久久久久久女国产乱| 91精品国产欧美一区二区成人| 欧美写真视频网站| 欧美性欧美巨大黑白大战| 色婷婷久久久久swag精品| 国产成人免费视频 | 91在线观看视频| 91色九色蝌蚪| 在线精品观看国产| 欧美日韩一区二区三区高清| 欧美伊人精品成人久久综合97| 欧美三级日本三级少妇99| 欧美亚洲国产一区在线观看网站 | 91蜜桃视频在线| 日本韩国一区二区三区视频| 欧洲精品一区二区三区在线观看| 欧美三级视频在线观看 | 在线综合+亚洲+欧美中文字幕| 制服丝袜中文字幕一区| 欧美一级高清片在线观看| 精品国产一区二区在线观看| 欧美国产日韩亚洲一区| 一区二区三区四区不卡在线| 亚洲国产日产av| 强制捆绑调教一区二区| 国产精品综合一区二区| 99久久综合99久久综合网站| 日本电影欧美片| 3d成人h动漫网站入口| 欧美电视剧在线观看完整版| 亚洲国产精品av| 亚洲一区二区三区在线播放| 蜜臀av性久久久久蜜臀av麻豆| 高清日韩电视剧大全免费| 色综合欧美在线| 欧美一级视频精品观看| 久久精品一区蜜桃臀影院| 亚洲精品成a人| 久久超级碰视频| 欧美日韩高清影院| 日韩欧美亚洲另类制服综合在线| 国产精品乱子久久久久| 亚洲sss视频在线视频| 国产精品99久久久久久久女警| 色悠悠亚洲一区二区| 精品国产一区a| 一区二区三区国产精品| 国产最新精品免费| 欧美日韩国产一级片| 日本一区二区三区四区| 手机精品视频在线观看| 成人高清视频在线| 日韩一区二区三区视频在线| 中文字幕一区在线| 精品亚洲免费视频| 欧美日韩一级二级| 国产精品美女久久久久av爽李琼| 丝袜a∨在线一区二区三区不卡| 成人性生交大片免费看中文网站| 91精品国产综合久久久久久漫画 | 亚洲品质自拍视频网站| 狠狠色综合日日| 欧美精品丝袜久久久中文字幕| 欧美高清在线视频| 九九国产精品视频| 欧美美女激情18p| 亚洲免费色视频| 成人午夜看片网址| 日韩精品在线一区| 首页综合国产亚洲丝袜| 日本道色综合久久| 成人欧美一区二区三区| 国模娜娜一区二区三区| 日韩视频在线一区二区| 亚洲午夜在线观看视频在线| av在线一区二区三区| 久久久电影一区二区三区| 玖玖九九国产精品| 91精品综合久久久久久| 亚洲一区二区偷拍精品| 色偷偷一区二区三区| 欧美国产一区视频在线观看| 国产在线精品视频| 精品日韩一区二区三区| 麻豆精品在线观看| 日韩视频一区二区三区在线播放| 午夜欧美大尺度福利影院在线看| 色妹子一区二区| 亚洲精品亚洲人成人网在线播放| 成+人+亚洲+综合天堂| 国产精品美女久久久久aⅴ国产馆| 国产成人在线看| 欧美国产精品一区| av在线不卡观看免费观看| 亚洲国产精品99久久久久久久久| 成人午夜私人影院| 中文字幕一区在线观看视频| 99久久久国产精品免费蜜臀| 亚洲青青青在线视频| 91久久一区二区| 亚洲一区二区欧美日韩| 欧美日韩一区二区三区视频| 日日夜夜免费精品视频| 欧美一二三在线| 国产真实乱对白精彩久久| 久久久不卡影院| 99在线精品一区二区三区| 一区二区三区在线观看国产| 欧美专区日韩专区| 男人操女人的视频在线观看欧美| 日韩欧美久久一区| 国产大陆亚洲精品国产| 中文字幕一区二区不卡| 欧美视频三区在线播放| 日本不卡一二三区黄网| 久久久欧美精品sm网站| 91视频在线看| 天堂影院一区二区| 26uuu国产日韩综合| 成人精品国产福利| 一区二区高清视频在线观看| 91精品国产免费| 国产98色在线|日韩| 伊人色综合久久天天| 日韩天堂在线观看| 99久久精品情趣|