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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? wapclient.java

?? jwap 協(xié)議 udp 可以用于手機通訊
?? JAVA
?? 第 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色乱码一区二区三区| 中文字幕+乱码+中文字幕一区| 中文字幕在线不卡国产视频| 亚洲福利视频一区| 色综合久久中文字幕综合网| 亚洲综合视频在线观看| 日韩精品一区二区三区蜜臀| 久久精品免费看| 国产精品你懂的在线欣赏| 国产日本欧洲亚洲| 欧美亚洲一区二区三区四区| 精品视频在线免费看| 91精品国产一区二区| 国产麻豆一精品一av一免费| 亚洲综合一区二区| 青青草97国产精品免费观看 | 国产一区二区三区免费观看| 亚洲精选免费视频| 日韩欧美国产一区二区在线播放| 欧美嫩在线观看| 天天做天天摸天天爽国产一区| 午夜精品久久久久久久久久| 亚洲天堂久久久久久久| 亚洲国产精品t66y| 91精品国产综合久久精品麻豆| 国产精品一级黄| 免费不卡在线观看| 日韩视频免费观看高清完整版 | 亚洲国产一区视频| 国产在线播精品第三| 亚洲少妇最新在线视频| 久久久久久久久久美女| 91麻豆精品国产自产在线| 久久香蕉国产线看观看99| 91精品国产免费久久综合| 欧美日韩国产精品成人| 日韩欧美在线不卡| 精品久久久久一区二区国产| 国产伦精品一区二区三区免费迷| 伊人性伊人情综合网| 看国产成人h片视频| 91国偷自产一区二区开放时间 | 一本一本久久a久久精品综合麻豆| 成人av网站在线| 国产女同互慰高潮91漫画| 精品久久一二三区| 欧美激情在线一区二区三区| 亚洲国产成人私人影院tom| 亚洲天堂2016| 亚洲一区av在线| 18欧美亚洲精品| 成人av午夜电影| 国产精品99久久久久| 国产一区二区影院| 美女任你摸久久| 免费人成在线不卡| 国产精品小仙女| 精品亚洲成a人| 国产精品一区二区在线观看网站| 午夜不卡av免费| 777午夜精品免费视频| 国产69精品久久777的优势| 亚洲午夜免费电影| 337p粉嫩大胆噜噜噜噜噜91av | 国产精品对白交换视频| 在线播放日韩导航| 91麻豆福利精品推荐| 六月丁香婷婷色狠狠久久| 亚洲人成网站影音先锋播放| 中文一区二区完整视频在线观看 | 欧美一级xxx| 精品va天堂亚洲国产| 韩国欧美一区二区| 午夜精品久久久久| 一区av在线播放| 日韩国产精品久久久久久亚洲| 蜜臀精品一区二区三区在线观看| 亚洲欧美日韩一区二区 | 成人免费观看av| 人人超碰91尤物精品国产| 国产三级一区二区三区| 欧美精品一卡二卡| 99re这里只有精品6| 国产一区欧美日韩| 日韩写真欧美这视频| 欧美日韩视频在线一区二区| 欧美mv日韩mv国产网站app| 欧美日韩一区不卡| 色88888久久久久久影院野外 | 在线观看国产91| 色综合av在线| 欧洲亚洲国产日韩| 欧美日韩国产系列| 欧美色综合网站| 欧美亚洲综合在线| 欧美精品乱码久久久久久按摩| 日本高清视频一区二区| 欧美日韩一区在线观看| 欧美体内she精视频| 91成人国产精品| 7878成人国产在线观看| 精品国产一区二区亚洲人成毛片 | 欧美无乱码久久久免费午夜一区 | 久久久99免费| 中文字幕日韩一区| 亚洲午夜国产一区99re久久| 亚洲国产一区二区视频| 蜜桃精品在线观看| 国产成人在线色| 色婷婷久久久亚洲一区二区三区| 欧美日韩日日夜夜| 免费在线成人网| 99久久精品99国产精品| 欧美性猛交xxxx乱大交退制版| 欧美肥大bbwbbw高潮| 久久精子c满五个校花| 一区二区三区不卡视频| 国产精品一线二线三线精华| 亚洲欧洲精品一区二区三区| 亚洲超丰满肉感bbw| 成人激情图片网| 日韩欧美成人激情| 亚洲精品美腿丝袜| 成人av在线播放网站| 日韩欧美高清一区| 亚洲国产你懂的| 成+人+亚洲+综合天堂| 久久久精品国产免费观看同学| 亚洲综合一区二区精品导航| 91视视频在线观看入口直接观看www| 这里只有精品免费| 一区二区在线观看视频在线观看| 黄色小说综合网站| 久久久电影一区二区三区| 午夜精品久久久久久久蜜桃app| 国产自产v一区二区三区c| 欧美日韩免费观看一区三区| 亚洲日本韩国一区| 播五月开心婷婷综合| 中文欧美字幕免费| jiyouzz国产精品久久| 久久精品一区四区| 成人中文字幕在线| 色一情一乱一乱一91av| ㊣最新国产の精品bt伙计久久| av电影一区二区| 亚洲亚洲人成综合网络| 91精品国产黑色紧身裤美女| 麻豆精品一区二区| 国产精品毛片高清在线完整版| 成人免费视频caoporn| 一区二区三区色| 欧美精品免费视频| www.欧美.com| 日韩二区在线观看| 国产精品麻豆一区二区| 欧美日韩一卡二卡三卡| 精品在线免费视频| 亚洲欧美在线另类| 3atv在线一区二区三区| 成人久久18免费网站麻豆 | 18欧美亚洲精品| 69久久99精品久久久久婷婷| 国产福利视频一区二区三区| 亚洲免费视频中文字幕| 日韩亚洲欧美在线| 欧美性xxxxxxxx| av爱爱亚洲一区| 久久99最新地址| 国产精品护士白丝一区av| 欧美精品久久一区| 一本色道久久综合狠狠躁的推荐| 美腿丝袜亚洲色图| 日韩精品国产欧美| 亚洲一区二区视频在线观看| 国产精品视频你懂的| 久久亚洲精精品中文字幕早川悠里| 一本一道久久a久久精品| 不卡高清视频专区| 亚洲免费观看高清在线观看| 精品日韩一区二区三区免费视频| 欧美色精品在线视频| 欧洲一区在线电影| 一本到不卡精品视频在线观看| 91精品国产一区二区三区| 欧洲一区二区三区在线| 911国产精品| 日韩片之四级片| 久久久久久久精| 国产婷婷色一区二区三区在线| 久久久久久久久久久久久女国产乱 | 日韩美女啊v在线免费观看| 久久精品99国产精品日本| 国产高清视频一区| 色综合久久久久久久久久久| 欧美日韩国产高清一区| 日韩精品一区二区三区视频| 精品久久人人做人人爱| 国产婷婷精品av在线| 欧美激情综合五月色丁香小说|