亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美日韩国产另类不卡| 老鸭窝一区二区久久精品| 成人网页在线观看| 国产日本一区二区| 99久久伊人网影院| 亚洲国产aⅴ天堂久久| 91精品国产欧美一区二区成人| 日本一不卡视频| 久久久精品欧美丰满| 91香蕉视频在线| 亚洲国产精品嫩草影院| 日韩精品一区国产麻豆| 国产成人av在线影院| 亚洲激情五月婷婷| 日韩一区二区免费电影| 久久日一线二线三线suv| 亚洲图片你懂的| 欧美性猛交xxxxxxxx| 男男gaygay亚洲| 欧美高清在线精品一区| 欧美亚洲一区二区在线| 久久66热re国产| 国产精品国产馆在线真实露脸| 欧美日韩视频在线观看一区二区三区| 久久精品国产一区二区三区免费看| 国产欧美精品一区aⅴ影院| 在线观看av一区二区| 美国十次了思思久久精品导航| 国产精品欧美一区二区三区| 在线播放中文一区| 成人免费毛片高清视频| 奇米777欧美一区二区| 《视频一区视频二区| 日韩一区和二区| 色丁香久综合在线久综合在线观看| 极品少妇xxxx精品少妇| 亚洲日本欧美天堂| 久久综合九色综合欧美亚洲| 欧美视频一区二| 99免费精品在线| 国产精品 欧美精品| 日韩精品免费专区| 亚洲综合色视频| 中文字幕精品一区二区三区精品| 91精品欧美综合在线观看最新| 不卡视频一二三| 国模套图日韩精品一区二区| 亚洲一区二区在线免费观看视频 | 视频一区视频二区在线观看| 久久综合国产精品| 6080国产精品一区二区| 一本久久综合亚洲鲁鲁五月天| 亚洲韩国精品一区| 欧美三级视频在线观看| 成人免费观看视频| 国产精品一二三四| 奇米777欧美一区二区| 午夜精品一区二区三区三上悠亚 | **欧美大码日韩| 国产日本一区二区| 精品999久久久| 日韩欧美一级特黄在线播放| 欧美日韩二区三区| 色老头久久综合| 色香色香欲天天天影视综合网| 成人美女在线视频| 国产不卡视频一区| 国产99久久久国产精品免费看| 久久99深爱久久99精品| 久久精品久久精品| 精品在线观看视频| 免费xxxx性欧美18vr| 青青草原综合久久大伊人精品| 天天色天天操综合| 免费高清视频精品| 精品一区二区av| 国产一区二区免费在线| 黄色小说综合网站| 国产一区二区不卡| 国产99精品视频| 成人app网站| 91麻豆产精品久久久久久| 91香蕉视频在线| 欧美日韩在线电影| 欧美一区二区大片| 精品久久99ma| 久久久精品综合| 亚洲视频在线一区二区| 夜夜揉揉日日人人青青一国产精品 | 国产免费观看久久| 国产精品视频麻豆| 一区二区三区中文字幕| 欧美一区二区免费观在线| 色婷婷av一区二区三区大白胸| 在线观看亚洲一区| 欧美精品tushy高清| 精品美女被调教视频大全网站| 久久只精品国产| 国产精品天美传媒沈樵| 亚洲黄色av一区| 天天操天天干天天综合网| 青青草一区二区三区| 国产成人自拍网| 色偷偷久久一区二区三区| 欧美三级视频在线| 欧美r级电影在线观看| 国产婷婷精品av在线| 亚洲黄色片在线观看| 日本中文字幕一区二区视频| 国产精品一区二区在线观看网站| av亚洲产国偷v产偷v自拍| 欧美日韩免费电影| 国产视频在线观看一区二区三区 | 亚洲综合久久久| 久久电影网站中文字幕 | 国产毛片精品国产一区二区三区| 99国内精品久久| 欧美一级二级三级蜜桃| 国产精品色哟哟网站| 日韩高清电影一区| 91色九色蝌蚪| 2023国产精华国产精品| 亚洲国产人成综合网站| 国产成人精品免费网站| 91麻豆精品国产91久久久久| 中文字幕在线一区免费| 久久9热精品视频| 欧美手机在线视频| 国产精品久久久久影院亚瑟 | 欧美体内she精视频| 久久精品视频在线看| 午夜精品一区二区三区三上悠亚 | 亚洲国产成人porn| 成人激情综合网站| 欧美精品一区二| 青青草视频一区| 欧美日韩在线播| 亚洲免费观看视频| 国产高清久久久| 日韩三级在线免费观看| 亚洲成a人v欧美综合天堂下载| 本田岬高潮一区二区三区| 久久综合九色综合97婷婷女人 | 国产日韩欧美不卡| 日韩精品电影在线| 在线免费不卡电影| 亚洲欧洲另类国产综合| 国产精品自产自拍| 欧美精品一区二区在线播放| 视频一区欧美日韩| 777久久久精品| 亚洲成人综合在线| 精品视频一区三区九区| 亚洲欧美日本韩国| 色www精品视频在线观看| 最新不卡av在线| 高清在线观看日韩| 日本一区二区在线不卡| 国产成人免费在线观看不卡| 国产欧美精品一区二区色综合朱莉| 国产一区二区三区精品视频| 久久精品男人天堂av| 麻豆91精品视频| 精品国产91亚洲一区二区三区婷婷| 爽爽淫人综合网网站| 4438成人网| 久久国产精品99久久久久久老狼| 欧美成人一区二区三区片免费| 天堂在线亚洲视频| 欧美sm美女调教| 国产激情精品久久久第一区二区| 欧美激情中文字幕| 91香蕉视频在线| 亚洲bdsm女犯bdsm网站| 91精品久久久久久久99蜜桃 | 99久久精品国产麻豆演员表| 国产精品国产三级国产a | 亚洲第一综合色| 91精品国产综合久久精品麻豆| 三级不卡在线观看| 精品久久久三级丝袜| 国产福利精品一区| 国产精品国产自产拍高清av| 色哦色哦哦色天天综合| 午夜精品久久久久久久久久久 | 一本一道综合狠狠老| 欧美电影免费观看高清完整版在| 久久国产精品露脸对白| 国产欧美精品国产国产专区| 99re这里只有精品视频首页| 一区二区久久久| 欧美美女视频在线观看| 国模一区二区三区白浆| 国产精品国产a| 777午夜精品免费视频| 国产精品18久久久久久久久久久久 | 亚洲成人自拍网| 欧美大度的电影原声| av一二三不卡影片| 丝袜a∨在线一区二区三区不卡|