亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
国产麻豆视频一区二区| 欧美性猛交xxxx黑人交| 欧洲av在线精品| 欧美mv日韩mv亚洲| 亚洲综合视频网| 国产成人综合亚洲网站| 日韩精品一区二区三区中文不卡 | 欧美裸体一区二区三区| 久久综合久色欧美综合狠狠| 亚洲成人资源网| 91香蕉视频mp4| wwwwww.欧美系列| 日韩 欧美一区二区三区| 欧美少妇bbb| 亚洲精品成人a在线观看| 99这里只有精品| 国产嫩草影院久久久久| 久久9热精品视频| 日韩女优毛片在线| 日本不卡高清视频| 欧美日韩大陆一区二区| 亚洲福利视频一区| 日本久久电影网| 一区二区在线观看免费| 在线视频你懂得一区| 亚洲黄一区二区三区| av一本久道久久综合久久鬼色| 久久精品亚洲精品国产欧美kt∨| 麻豆成人久久精品二区三区小说| 欧美日韩精品福利| 日韩国产精品大片| 欧美一区二区女人| 精品一区二区三区蜜桃| 欧美精品一区二区三区四区| 国产剧情一区二区| 国产精品美女久久久久久2018| 风流少妇一区二区| 亚洲精品少妇30p| 欧美视频中文字幕| 日韩av高清在线观看| 精品不卡在线视频| 成人一级片网址| 亚洲手机成人高清视频| 欧美在线一二三四区| 天堂影院一区二区| 精品国产91九色蝌蚪| 成人性色生活片免费看爆迷你毛片| 国产精品国产三级国产aⅴ入口| 91污片在线观看| 日韩成人一区二区三区在线观看| 日韩欧美激情在线| 国产一区二区三区蝌蚪| 成人免费在线播放视频| 在线观看日韩一区| 美女爽到高潮91| 国产精品嫩草99a| 色诱视频网站一区| 精品在线一区二区三区| 最新成人av在线| 在线观看91精品国产麻豆| 国产一区欧美日韩| 一区二区免费看| 欧美大片顶级少妇| 91论坛在线播放| 卡一卡二国产精品 | 日韩欧美亚洲一区二区| 国产成人精品三级| 一区二区三区精品视频在线| 欧美成人精品高清在线播放| 99久久精品免费看| 蜜桃91丨九色丨蝌蚪91桃色| 国产精品午夜在线观看| 日韩一区二区三区视频在线 | 成人高清免费观看| 亚洲国产欧美另类丝袜| 欧美激情一区在线| 91精品国产综合久久精品| 国产成人av资源| 日韩精品成人一区二区三区| 中文字幕中文字幕在线一区| 日韩欧美一级二级| 欧美自拍丝袜亚洲| 成人app软件下载大全免费| 日本不卡高清视频| 亚洲与欧洲av电影| 国产精品精品国产色婷婷| 精品剧情在线观看| 欧美另类一区二区三区| 91浏览器打开| av在线一区二区| 国产精品18久久久久久久网站| 亚洲成人在线免费| 亚洲人成影院在线观看| 国产精品女主播av| 国产日韩欧美精品综合| 日韩视频一区二区三区在线播放| 在线观看视频欧美| 色综合一个色综合亚洲| 丁香网亚洲国际| 国产精品一区二区不卡| 久久精品国产网站| 亚洲成人av一区二区| 亚洲一区二区精品3399| 亚洲精品视频在线观看免费| 最近中文字幕一区二区三区| 欧美激情在线看| 国产精品每日更新在线播放网址| 久久亚洲二区三区| 欧美—级在线免费片| 国产精品无人区| 亚洲欧美怡红院| 亚洲精品免费一二三区| 亚洲欧美视频在线观看视频| 亚洲私人影院在线观看| 一区二区三区加勒比av| 一区二区久久久| 亚洲v精品v日韩v欧美v专区| 亚洲一级二级三级| 调教+趴+乳夹+国产+精品| 亚洲6080在线| 老鸭窝一区二区久久精品| 九色综合国产一区二区三区| 国产激情视频一区二区在线观看| 国产高清在线观看免费不卡| 成人看片黄a免费看在线| 99在线精品观看| 在线一区二区三区四区五区| 欧美亚洲国产一区二区三区va| 欧美性色黄大片手机版| 91麻豆精品国产91久久久久久| 日韩亚洲欧美高清| 国产日韩视频一区二区三区| 一色桃子久久精品亚洲| 亚洲综合精品自拍| 久久精品99国产精品日本| 福利电影一区二区| 欧美日韩在线精品一区二区三区激情| 欧美日本国产一区| 国产午夜三级一区二区三| 《视频一区视频二区| 三级在线观看一区二区| 国产一区二区三区四| 色老头久久综合| 26uuu精品一区二区| 最近日韩中文字幕| 久久99热国产| 色综合色综合色综合色综合色综合| 欧美精品丝袜中出| 国产精品久久影院| 日韩av一区二区三区四区| av在线一区二区| 精品久久一区二区三区| 亚洲最新在线观看| 国产黄人亚洲片| 欧美熟乱第一页| 国产精品成人在线观看| 久久成人免费网| 91成人国产精品| 亚洲国产精品精华液2区45| 亚洲成a人v欧美综合天堂| 成人美女视频在线观看18| 欧美第一区第二区| 亚洲国产你懂的| 成人av在线一区二区三区| 欧美一区二区在线不卡| 亚洲精品日韩一| 成人天堂资源www在线| 日韩视频在线一区二区| 亚洲一区二区三区四区五区中文| 丰满白嫩尤物一区二区| 日韩免费视频线观看| 亚洲国产日韩综合久久精品| 93久久精品日日躁夜夜躁欧美| 精品国产乱码久久久久久1区2区| 亚洲国产日韩a在线播放性色| 91在线一区二区| 国产精品欧美精品| 国产二区国产一区在线观看| 日韩三级精品电影久久久 | 亚洲综合一区在线| 成人性色生活片免费看爆迷你毛片| 日韩精品一区二区三区中文不卡| 亚洲va韩国va欧美va| 在线观看一区日韩| 亚洲欧美日韩小说| 99久久99久久免费精品蜜臀| 久久久久久9999| 国内成人自拍视频| 精品国产一区二区三区四区四| 免费久久99精品国产| 欧美人成免费网站| 天天综合色天天综合色h| 在线欧美日韩国产| 亚洲制服丝袜一区| 欧美三区在线观看| 三级久久三级久久久| 制服丝袜中文字幕一区| 日本不卡在线视频| 精品久久国产字幕高潮| 国产一区在线观看视频|